-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
executable file
·52 lines (42 loc) · 1.75 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
cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
project(kronos)
set(KRONOS_QT_VERSION "4" CACHE STRING "Qt Version to use when building Kronos")
# set Paraview's Qt version to the same used for Kronos
set(PARAVIEW_QT_VERSION ${KRONOS_QT_VERSION})
set(KRONOS_BIN_DIR ${CMAKE_BINARY_DIR}/src CACHE PATH "Output path of Kronos binaries")
# use ccache if possible to speed up the build process
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif(CCACHE_FOUND)
# change the output folder for libraries and binaries
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${KRONOS_BIN_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${KRONOS_BIN_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${KRONOS_BIN_DIR})
option(SAVE_TEMPS "Save temporary files" OFF)
if(SAVE_TEMPS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -save-temps")
endif(SAVE_TEMPS)
option(BUILD_TESTING "Build the testing environment" ON)
# register subprojects
add_subdirectory(src)
# add test subproject only on unix (workaround until GTest is introduced)
if(BUILD_TESTING)
set(TEST_BIN_DIR ${CMAKE_BINARY_DIR}/test CACHE PATH "Output path of Unit Test binaries")
add_subdirectory(test)
# enable ctest capabilities
enable_testing()
# tests are added here and not in the ./test folder to make it possible to
# simply run `make test` in the root directory to run the tests
file(GLOB_RECURSE testClasses ./test/**/Test*.cpp)
foreach(test ${testClasses})
get_filename_component(testName ${test} NAME_WE)
add_test(
NAME ${testName}
COMMAND UnitTester --gtest_filter=${testName}.*
WORKING_DIRECTORY ${TEST_BIN_DIR}
)
endforeach()
endif()