-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
47 lines (32 loc) · 1.7 KB
/
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
cmake_minimum_required(VERSION 3.16)
project(multi_subproject_template)
set(CMAKE_CXX_STANDARD 14)
set(GLOBAL_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}/install)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${GLOBAL_OUTPUT_PATH})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${GLOBAL_OUTPUT_PATH})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${GLOBAL_OUTPUT_PATH})
foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${GLOBAL_OUTPUT_PATH})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${GLOBAL_OUTPUT_PATH})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${GLOBAL_OUTPUT_PATH})
endforeach(OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES)
link_directories(${GLOBAL_OUTPUT_PATH})
add_subdirectory(src/lib1)
include_directories(src/lib1/inc)
add_subdirectory(src/lib2)
include_directories(src/lib2/inc)
add_subdirectory(src/app1)
add_subdirectory(src/app2)
install(FILES ${executables} DESTINATION "bin")
install(FILES ${shared_libraries} DESTINATION "bin")
install(FILES ${static_libraries} DESTINATION "bin")
file(GLOB executables "${GLOBAL_OUTPUT_PATH}/*.exe")
file(GLOB shared_libraries "${GLOBAL_OUTPUT_PATH}/*.dll")
file(GLOB static_libraries "${GLOBAL_OUTPUT_PATH}/*.lib")
# SDK Installation
install(DIRECTORY "src/lib1/inc/" DESTINATION ${GLOBAL_OUTPUT_PATH} FILES_MATCHING PATTERN "*.h")
install(DIRECTORY "src/lib1/inc/" DESTINATION ${GLOBAL_OUTPUT_PATH} FILES_MATCHING PATTERN "*.hpp")
install(DIRECTORY "src/lib2/inc/" DESTINATION ${GLOBAL_OUTPUT_PATH} FILES_MATCHING PATTERN "*.h")
install(DIRECTORY "src/lib2/inc/" DESTINATION ${GLOBAL_OUTPUT_PATH} FILES_MATCHING PATTERN "*.hpp")