generated from orgarten/CppTemplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
75 lines (59 loc) · 2.91 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
67
68
69
70
71
72
73
CMAKE_MINIMUM_REQUIRED(VERSION 3.11.0)
PROJECT(jsBridge++)
enable_language(CXX)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
###################################################################
# define options which can be set by user
###################################################################
include(cmake/cache_options.cmake)
###################################################################
# Setting compiler flags regarding optimization etc for gcc, msvc, clang
###################################################################
# Compiler Flags
set(CMAKE_CXX_STANDARD 17)
IF (CMAKE_COMPILER_IS_GNUCXX)
add_compile_options(-std=c++17 -O3 -Wall -fPIC -funroll-loops -march=native)
ELSEIF (MSVC)
# this currently works, but is not really the way to go..
add_compile_options(/std:c++17 /Wall /arch:AVX)
ELSE ()
add_compile_options(-std=c++17 -O3 -Wall -fPIC -funroll-loops -march=native)
ENDIF (CMAKE_COMPILER_IS_GNUCXX)
find_package(websocketpp)
## Allows us the check whether a compiler accepts flags or not
INCLUDE(CheckCXXCompilerFlag)
## loads definitions for standard gnu install directories
INCLUDE(GNUInstallDirs)
###################################################################
# add bridge and client libs to CMakeLists.txt
###################################################################
add_subdirectory(jsBridge++)
###################################################################
# add bridge and client applications
###################################################################
add_subdirectory(apps)
###################################################################
# Option dependent builds (e.g. testing, benchmarks, ...)
###################################################################
IF(BUILD_TEST)
ENABLE_TESTING()
add_subdirectory(tests)
ENDIF()
###################################################################
# PACKAGING (create config files)
###################################################################
SET(JSBRIDGEPP_VERSION_NUMBER 1.0.0)
SET(JSBRIDGEPP_VERSION_STRING ${JSBRIDGEPP_VERSION_NUMBER})
SET(JSBRIDGEPP_DEFINITIONS "")
SET(JSBRIDGEPP_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include")
SET(JSBRIDGEPP_ROOT_DIR ${CMAKE_INSTALL_PREFIX})
INCLUDE(CMakePackageConfigHelpers)
CONFIGURE_PACKAGE_CONFIG_FILE(
${CMAKE_CURRENT_SOURCE_DIR}/cmake/jsBridgePP.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/jsBridgePPConfig.cmake
PATH_VARS JSBRIDGEPP_INCLUDE_DIR JSBRIDGEPP_ROOT_DIR
INSTALL_DESTINATION ${CMAKE_INSTALL_DATADIR}/jsBridgePP/cmake
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
WRITE_BASIC_PACKAGE_VERSION_FILE(jsBridgePPConfigVersion.cmake VERSION ${JSBRIDGEPP_VERSION_NUMBER} COMPATIBILITY SameMajorVersion)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/jsBridgePPConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/jsBridgePPConfigVersion.cmake DESTINATION ${CMAKE_INSTALL_DATADIR}/jsBridgePP/cmake)
INSTALL(DIRECTORY jsBridgePP DESTINATION include)