Browse Source

More consistent installation

enhancement_3
Trevor Irons 8 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
 cmake_minimum_required (VERSION 2.8.12)
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
 if(POLICY CMP0015)
6
 if(POLICY CMP0015)
4
 	cmake_policy(SET CMP0015 NEW)
7
 	cmake_policy(SET CMP0015 NEW)
5
 endif()
8
 endif()
6
-
7
-
9
+set(CMAKE_MACOSX_RPATH 1)
8
 
10
 
9
 project (Lemma CXX)
11
 project (Lemma CXX)
10
 
12
 
24
 # endif(NOT HAVEHG)
26
 # endif(NOT HAVEHG)
25
 
27
 
26
 option(BUILD_SHARED_LIBS OFF)
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
 # External Projects
36
 # External Projects
66
 		PATCH_COMMAND ""
73
 		PATCH_COMMAND ""
67
     	PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/tinyxml2
74
     	PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/tinyxml2
68
     	CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=ON 
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
 	add_compile_options(-DTINYXMLSUPPORT) 
78
 	add_compile_options(-DTINYXMLSUPPORT) 
72
 endif()
79
 endif()
103
 # Lemma Configuration
110
 # Lemma Configuration
104
 #####################
111
 #####################
105
 
112
 
106
-
107
-
108
 ####################
113
 ####################
109
 # Add the c++11 flag 
114
 # Add the c++11 flag 
110
 # TODO add compiler specific instructions
115
 # TODO add compiler specific instructions
112
 CHECK_CXX_COMPILER_FLAG(-std=c++11 COMPILER_SUPPORTS_CXX11)
117
 CHECK_CXX_COMPILER_FLAG(-std=c++11 COMPILER_SUPPORTS_CXX11)
113
 CHECK_CXX_COMPILER_FLAG(-std=c++0x COMPILER_SUPPORTS_CXX0X)
118
 CHECK_CXX_COMPILER_FLAG(-std=c++0x COMPILER_SUPPORTS_CXX0X)
114
 if(COMPILER_SUPPORTS_CXX11)
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
 elseif(COMPILER_SUPPORTS_CXX0X)
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
 else()
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
 endif()
125
 endif()
121
 
126
 
122
 set(LEMMA_VERSION_MAJOR "0")
127
 set(LEMMA_VERSION_MAJOR "0")
125
 set(LEMMA_VERSION "${LEMMA_VERSION_MAJOR}.${LEMMA_VERSION_MINOR}.${LEMMA_VERSION_PATCH}")
130
 set(LEMMA_VERSION "${LEMMA_VERSION_MAJOR}.${LEMMA_VERSION_MINOR}.${LEMMA_VERSION_PATCH}")
126
 
131
 
127
 configure_file (
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
 include_directories("${PROJECT_BINARY_DIR}/include")
136
 include_directories("${PROJECT_BINARY_DIR}/include")
132
 
137
 

+ 6
- 4
LemmaCore/CMakeLists.txt View File

12
 add_library( lemmacore ${SOURCE} )  
12
 add_library( lemmacore ${SOURCE} )  
13
 
13
 
14
 set_target_properties(lemmacore PROPERTIES 
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
 # Linking
20
 # Linking
19
 add_dependencies(lemmacore YAML-CPP)
21
 add_dependencies(lemmacore YAML-CPP)
32
 # Install
34
 # Install
33
 install ( TARGETS lemmacore DESTINATION ${CMAKE_INSTALL_PREFIX}/lib )
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
 	add_subdirectory(examples)
39
 	add_subdirectory(examples)
38
 endif()
40
 endif()

+ 1
- 0
Matplot_vtk/CMakeLists.txt View File

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

Loading…
Cancel
Save