-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
54 lines (41 loc) · 2.63 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
cmake_minimum_required(VERSION 2.8)
project(cube)
set(CMAKE_BUILD_TYPE Debug CACHE STRING "" FORCE)
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
# SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
# SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pg")
SET(THREADTEST_COMPILE_FLAG "-std=c++11 -pthread")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${THREADTEST_COMPILE_FLAG} -Wbuiltin-declaration-mismatch")
SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--no-as-needed ${THREADTEST_COMPILE_FLAG} -Wbuiltin-declaration-mismatch")
add_subdirectory(src)
# Install
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
configure_package_config_file(
"${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}Config.cmake.in"
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION
${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/cmake)
install(EXPORT ${PROJECT_NAME}_Targets
FILE ${PROJECT_NAME}Targets.cmake
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/cmake)
install(EXPORT ${PROJECT_NAME}_linenoise_Targets
FILE ${PROJECT_NAME}_linenoise_Targets.cmake
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/cmake)
install(FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/cmake)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/stdlib DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME} FILES_MATCHING PATTERN "*.cube" PATTERN "libs/" EXCLUDE)
if (UNIX)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/stdlib/libs/ DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/stdlib/libs FILES_MATCHING PATTERN "*.so")
else(UNIX)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/stdlib/libs/ DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/stdlib/libs FILES_MATCHING PATTERN "*.dll" PATTERN "libs/Debug" EXCLUDE PATTERN "libs/Release" EXCLUDE)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/stdlib/libs/Debug/ DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/stdlib/libs FILES_MATCHING PATTERN "*.dll")
install(DIRECTORY ${PROJECT_SOURCE_DIR}/stdlib/libs/Release/ DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/stdlib/libs FILES_MATCHING PATTERN "*.dll")
endif(UNIX)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/samples DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME})
install(DIRECTORY ${PROJECT_SOURCE_DIR}/test DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME})
install(DIRECTORY ${PROJECT_SOURCE_DIR}/bin
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}
PATTERN "bin/*.*"
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ
)