-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
66 lines (55 loc) · 2.17 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
cmake_minimum_required(VERSION 3.0)
cmake_policy(VERSION 3.0)
project(puloon-cxx VERSION 0.1.0 LANGUAGES CXX)
# project variables
set(PULOON_PACKAGE_NAME ${PROJECT_NAME})
set(PULOON_EXPORT_NAME ${PULOON_PACKAGE_NAME}-targets)
set(PULOON_CONFIG_FILENAME ${PULOON_PACKAGE_NAME}-config.cmake)
set(PULOON_CONFIGVERSION_FILENAME ${PULOON_PACKAGE_NAME}-config-version.cmake)
set(PULOON_CMAKE_DIR cmake)
set(PULOON_TARGET_NAME ${PROJECT_NAME})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
# set output directories for each build configuration
foreach(CONFIG ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER ${CONFIG} UPPER_CONFIG)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${UPPER_CONFIG} ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/${CONFIG})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${UPPER_CONFIG} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CONFIG})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${UPPER_CONFIG} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CONFIG})
endforeach(CONFIG CMAKE_CONFIGURATION_TYPES)
add_subdirectory(src)
configure_file(
${PULOON_CMAKE_DIR}/${PULOON_CONFIG_FILENAME}.in
${PULOON_CMAKE_DIR}/${PULOON_CONFIG_FILENAME}
@ONLY
)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(${PULOON_CMAKE_DIR}/${PULOON_CONFIGVERSION_FILENAME}
COMPATIBILITY SameMajorVersion
)
export(EXPORT ${PULOON_EXPORT_NAME} FILE ${PULOON_CMAKE_DIR}/${PULOON_EXPORT_NAME}.cmake)
export(PACKAGE ${PULOON_PACKAGE_NAME})
if(WIN32)
install(FILES
${PROJECT_BINARY_DIR}/${PULOON_CMAKE_DIR}/${PULOON_CONFIG_FILENAME}
${PROJECT_BINARY_DIR}/${PULOON_CMAKE_DIR}/${PULOON_CONFIGVERSION_FILENAME}
DESTINATION ${PULOON_CMAKE_DIR}
)
install(EXPORT ${PULOON_EXPORT_NAME}
DESTINATION ${PULOON_CMAKE_DIR}
)
else(WIN32)
install(FILES
${PROJECT_BINARY_DIR}/${PULOON_CMAKE_DIR}/${PULOON_CONFIG_FILENAME}
${PROJECT_BINARY_DIR}/${PULOON_CMAKE_DIR}/${PULOON_CONFIGVERSION_FILENAME}
DESTINATION lib/${PULOON_CMAKE_DIR}/${PULOON_PACKAGE_NAME}
)
install(EXPORT ${PULOON_EXPORT_NAME}
DESTINATION lib/${PULOON_CMAKE_DIR}/${PULOON_PACKAGE_NAME}
)
endif(WIN32)
install(DIRECTORY
include
DESTINATION .
)