Browse code

modernize CMakeLists.txt

Nat! authored on 11/09/2017 13:23:54
Showing 2 changed files
... ...
@@ -1,51 +1,27 @@
1
-cmake_minimum_required (VERSION 3.0)
1
+cmake_minimum_required( VERSION 3.0)
2 2
 
3
-project(mulle-concurrent C)
3
+project( mulle-concurrent C)
4 4
 
5
-cmake_policy(SET CMP0054 NEW)
6 5
 
7 6
 set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/mulle-configuration/cmake)
8
-message(STATUS "CMAKE_MODULE_PATH is ${CMAKE_MODULE_PATH}")
9
-message(STATUS "CMAKE_BUILD_TYPE is ${CMAKE_BUILD_TYPE}")
7
+message( STATUS "CMAKE_MODULE_PATH is ${CMAKE_MODULE_PATH}")
8
+message( STATUS "CMAKE_BUILD_TYPE is ${CMAKE_BUILD_TYPE}")
10 9
 if( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
11 10
   include( Debug)
12 11
 else()
13 12
   include( Release)
14 13
 endif()
15 14
 
16
-# using include_directories is a little bit shitty
17
-include_directories( src
18
-src/hashmap
19
-src/pointerarray
20
-)
21
-
22
-set( HEADERS
23
-src/mulle_concurrent.h
24
-src/mulle_concurrent_types.h
25
-src/pointerarray/mulle_concurrent_pointerarray.h
26
-src/hashmap/mulle_concurrent_hashmap.h
27
-)
28
-
29
-add_library( mulle_concurrent
30
-src/pointerarray/mulle_concurrent_pointerarray.c
31
-src/hashmap/mulle_concurrent_hashmap.c
32
-)
33
-
34
-add_library( mulle_concurrent_standalone SHARED
35
-src/mulle_concurrent_standalone.c
36
-)
37
-
38
-add_dependencies( mulle_concurrent_standalone mulle_concurrent)
15
+include( CMakeSourcesAndHeaders.txt)
39 16
 
40 17
 find_library( MULLE_ABA_LIBRARY            NAMES mulle_aba)
18
+message( STATUS "MULLE_ABA_LIBRARY is ${MULLE_ABA_LIBRARY}")
41 19
 find_library( MULLE_ALLOCATOR_LIBRARY      NAMES mulle_allocator)
20
+message( STATUS "MULLE_ALLOCATOR_LIBRARY is ${MULLE_ALLOCATOR_LIBRARY}")
42 21
 find_library( MULLE_TEST_ALLOCATOR_LIBRARY NAMES mulle_test_allocator)
22
+message( STATUS "MULLE_TEST_ALLOCATOR_LIBRARY is ${MULLE_TEST_ALLOCATOR_LIBRARY}")
43 23
 find_library( MULLE_THREAD_LIBRARY         NAMES mulle_thread)
44
-
45
-message(STATUS "MULLE_ABA_LIBRARY is ${MULLE_ABA_LIBRARY}")
46
-message(STATUS "MULLE_ALLOCATOR_LIBRARY is ${MULLE_ALLOCATOR_LIBRARY}")
47
-message(STATUS "MULLE_TEST_ALLOCATOR_LIBRARY is ${MULLE_TEST_ALLOCATOR_LIBRARY}")
48
-message(STATUS "MULLE_THREAD_LIBRARY is ${MULLE_THREAD_LIBRARY}")
24
+message( STATUS "MULLE_THREAD_LIBRARY is ${MULLE_THREAD_LIBRARY}")
49 25
 
50 26
 set( DEPENDENCY_LIBRARIES
51 27
 ${MULLE_ABA_LIBRARY}
... ...
@@ -54,25 +30,24 @@ ${MULLE_TEST_ALLOCATOR_LIBRARY}
54 54
 ${MULLE_THREAD_LIBRARY}
55 55
 )
56 56
 
57
+###
58
+#
59
+#
60
+add_library( mulle_concurrent
61
+src/pointerarray/mulle_concurrent_pointerarray.c
62
+src/hashmap/mulle_concurrent_hashmap.c
63
+)
64
+
65
+set( STANDALONE_BASE_NAME "mulle_concurrent")
66
+set( STANDALONE_NAME "mulle_concurrent_standalone")
67
+
57 68
 set( TARGET_ALL_LOAD_LIBRARIES
58 69
 $<TARGET_FILE:mulle_concurrent>
59 70
 ${DEPENDENCY_LIBRARIES}
60 71
 )
61 72
 
62
-if( FORCE_LOAD)
63
-   set( TMP)
64
-   foreach( library ${TARGET_ALL_LOAD_LIBRARIES})
65
-      list( APPEND TMP "${FORCE_LOAD} ${library}")
66
-   endforeach( library)
67
-   set( TARGET_ALL_LOAD_LIBRARIES ${TMP})
68
-endif()
73
+include( Standalone)
69 74
 
70 75
 
71
-TARGET_LINK_LIBRARIES( mulle_concurrent_standalone
72
-${BEGIN_ALL_LOAD}
73
-${TARGET_ALL_LOAD_LIBRARIES}
74
-${END_ALL_LOAD}
75
-)
76
-
77 76
 INSTALL( TARGETS mulle_concurrent_standalone mulle_concurrent DESTINATION "lib")
78 77
 INSTALL( FILES ${HEADERS} DESTINATION "include/mulle_concurrent")
79 78
new file mode 100644
... ...
@@ -0,0 +1,18 @@
0
+# using include_directories is a little bit shitty
1
+include_directories( src
2
+src/hashmap
3
+src/pointerarray
4
+)
5
+
6
+set( HEADERS
7
+src/mulle_concurrent.h
8
+src/mulle_concurrent_types.h
9
+src/pointerarray/mulle_concurrent_pointerarray.h
10
+src/hashmap/mulle_concurrent_hashmap.h
11
+)
12
+
13
+
14
+set( SOURCES
15
+src/pointerarray/mulle_concurrent_pointerarray.c
16
+src/hashmap/mulle_concurrent_hashmap.c
17
+)