Browse Source

More consistent installation

enhancement_3
Trevor Irons 9 years ago
parent
commit
5b3e18f19b
3 changed files with 22 additions and 14 deletions
  1. 15
    10
      CMakeLists.txt
  2. 6
    4
      LemmaCore/CMakeLists.txt
  3. 1
    0
      Matplot_vtk/CMakeLists.txt

+ 15
- 10
CMakeLists.txt View File

@@ -1,10 +1,12 @@
1 1
 cmake_minimum_required (VERSION 2.8.12)
2 2
 
3
+# Mac OSX RPATH is weird 
4
+# enable @rpath in the install name for any shared library being built
5
+# note: it is planned that a future version of CMake will enable this by default
3 6
 if(POLICY CMP0015)
4 7
 	cmake_policy(SET CMP0015 NEW)
5 8
 endif()
6
-
7
-
9
+set(CMAKE_MACOSX_RPATH 1)
8 10
 
9 11
 project (Lemma CXX)
10 12
 
@@ -24,6 +26,11 @@ endif(NOT HAVEGIT)
24 26
 # endif(NOT HAVEHG)
25 27
 
26 28
 option(BUILD_SHARED_LIBS OFF)
29
+if(BUILD_SHARED_LIBS)
30
+	set(LABEL_SUFFIX "shared")
31
+else()
32
+	set(LABEL_SUFFIX "static")
33
+endif()
27 34
 
28 35
 ###################
29 36
 # External Projects
@@ -66,7 +73,7 @@ if ( TINYXML_SUPPORT )
66 73
 		PATCH_COMMAND ""
67 74
     	PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/tinyxml2
68 75
     	CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=ON 
69
-#-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
76
+		#-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
70 77
 	)
71 78
 	add_compile_options(-DTINYXMLSUPPORT) 
72 79
 endif()
@@ -103,8 +110,6 @@ endif()
103 110
 # Lemma Configuration
104 111
 #####################
105 112
 
106
-
107
-
108 113
 ####################
109 114
 # Add the c++11 flag 
110 115
 # TODO add compiler specific instructions
@@ -112,11 +117,11 @@ include(CheckCXXCompilerFlag)
112 117
 CHECK_CXX_COMPILER_FLAG(-std=c++11 COMPILER_SUPPORTS_CXX11)
113 118
 CHECK_CXX_COMPILER_FLAG(-std=c++0x COMPILER_SUPPORTS_CXX0X)
114 119
 if(COMPILER_SUPPORTS_CXX11)
115
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
120
+	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
116 121
 elseif(COMPILER_SUPPORTS_CXX0X)
117
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
122
+	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
118 123
 else()
119
-  message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
124
+	message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
120 125
 endif()
121 126
 
122 127
 set(LEMMA_VERSION_MAJOR "0")
@@ -125,8 +130,8 @@ set(LEMMA_VERSION_PATCH "1")
125 130
 set(LEMMA_VERSION "${LEMMA_VERSION_MAJOR}.${LEMMA_VERSION_MINOR}.${LEMMA_VERSION_PATCH}")
126 131
 
127 132
 configure_file (
128
-  "${PROJECT_SOURCE_DIR}/include/LemmaConfig.h.in"
129
-  "${PROJECT_BINARY_DIR}/include/LemmaConfig.h"
133
+	"${PROJECT_SOURCE_DIR}/include/LemmaConfig.h.in"
134
+	"${PROJECT_BINARY_DIR}/include/LemmaConfig.h"
130 135
 )
131 136
 include_directories("${PROJECT_BINARY_DIR}/include")
132 137
 

+ 6
- 4
LemmaCore/CMakeLists.txt View File

@@ -12,8 +12,10 @@ add_subdirectory("src")
12 12
 add_library( lemmacore ${SOURCE} )  
13 13
 
14 14
 set_target_properties(lemmacore PROPERTIES 
15
-	VERSION ${LEMMA_VERSION_MAJOR}
16
-	SOVERSION ${LEMMA_VERSION})
15
+	VERSION  "${LEMMA_VERSION}"
16
+	SOVERSION "${LEMMA_VERSION_MAJOR}.${LEMMA_VERSION_MINOR}"
17
+	PROJECT_LABEL "Lemma ${LABEL_SUFFIX}"
18
+)
17 19
 
18 20
 # Linking
19 21
 add_dependencies(lemmacore YAML-CPP)
@@ -32,7 +34,7 @@ target_link_libraries(lemmacore "yaml-cpp")
32 34
 # Install
33 35
 install ( TARGETS lemmacore DESTINATION ${CMAKE_INSTALL_PREFIX}/lib )
34 36
 
35
-option( BUILDEXAMPLES "Compile example Lemma applications" OFF )
36
-if (BUILDEXAMPLES)
37
+option( LEMMABUILDEXAMPLES "Compile example Lemma applications" OFF )
38
+if (LEMMABUILDEXAMPLES)
37 39
 	add_subdirectory(examples)
38 40
 endif()

+ 1
- 0
Matplot_vtk/CMakeLists.txt View File

@@ -1,2 +1,3 @@
1 1
 add_library( matplot matplot.cpp )
2 2
 target_link_libraries(matplot ${VTK_LIBRARIES})
3
+install ( TARGETS matplot DESTINATION ${CMAKE_INSTALL_PREFIX}/lib )

Loading…
Cancel
Save