-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
48 lines (32 loc) · 972 Bytes
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
cmake_minimum_required(VERSION 2.8)
project(OI)
#0 options
#1 var
#2 tool chain
#3 gengerator
#4 add components
file(GLOB ${PROJECT_NAME}_COMPONENTS
component/*/CMakeLists.txt)
if(${PROJECT_NAME}_COMPONENTS)
foreach(COMPONENTS ${${PROJECT_NAME}_COMPONENTS})
string(REPLACE "/CMakeLists.txt" "" COMPONENT ${COMPONENTS})
message("\nadd ${COMPONENT} as a component")
add_subdirectory(${COMPONENT})
endforeach(COMPONENTS)
else()
message("no component for ${PROJECT_NAME} ${${PROJECT_NAME}_COMPONENTS}")
endif()
#5 build OI
#5.1 find cmake files
file(GLOB_RECURSE ${PROJECT_NAME}_CMAKE_TEMPLATE
cmake/*
)
#6 test
#7 install
#7.2 uninstall
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
#8 clean