-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
66 lines (55 loc) · 2.13 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(ccnet-cxx VERSION 0.1.0 LANGUAGES CXX)
# project variables
set(CCNET_PACKAGE_NAME ${PROJECT_NAME})
set(CCNET_EXPORT_NAME ${CCNET_PACKAGE_NAME}-targets)
set(CCNET_CONFIG_FILENAME ${CCNET_PACKAGE_NAME}-config.cmake)
set(CCNET_CONFIGVERSION_FILENAME ${CCNET_PACKAGE_NAME}-config-version.cmake)
set(CCNET_CMAKE_DIR cmake)
set(CCNET_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(
${CCNET_CMAKE_DIR}/${CCNET_CONFIG_FILENAME}.in
${CCNET_CMAKE_DIR}/${CCNET_CONFIG_FILENAME}
@ONLY
)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(${CCNET_CMAKE_DIR}/${CCNET_CONFIGVERSION_FILENAME}
COMPATIBILITY SameMajorVersion
)
export(EXPORT ${CCNET_EXPORT_NAME} FILE ${CCNET_CMAKE_DIR}/${CCNET_EXPORT_NAME}.cmake)
export(PACKAGE ${CCNET_PACKAGE_NAME})
if(WIN32)
install(FILES
${PROJECT_BINARY_DIR}/${CCNET_CMAKE_DIR}/${CCNET_CONFIG_FILENAME}
${PROJECT_BINARY_DIR}/${CCNET_CMAKE_DIR}/${CCNET_CONFIGVERSION_FILENAME}
DESTINATION ${CCNET_CMAKE_DIR}
)
install(EXPORT ${CCNET_EXPORT_NAME}
DESTINATION ${CCNET_CMAKE_DIR}
)
else(WIN32)
install(FILES
${PROJECT_BINARY_DIR}/${CCNET_CMAKE_DIR}/${CCNET_CONFIG_FILENAME}
${PROJECT_BINARY_DIR}/${CCNET_CMAKE_DIR}/${CCNET_CONFIGVERSION_FILENAME}
DESTINATION lib/${CCNET_CMAKE_DIR}/${CCNET_PACKAGE_NAME}
)
install(EXPORT ${CCNET_EXPORT_NAME}
DESTINATION lib/${CCNET_CMAKE_DIR}/${CCNET_PACKAGE_NAME}
)
endif(WIN32)
install(DIRECTORY
include
DESTINATION .
)