forked from AMSUN-Berlin/daestruct
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
71 lines (53 loc) · 2.33 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
#The minimum CMake version required to build this project
cmake_minimum_required(VERSION 2.8)
#Set a new CMake project
project(daestruct)
#If the build script is called from a parent project,
# use the configuration from there.
if(NOT COMMAND if_defined_set)
set(cmake_directory ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
endif()
#Set the CMake module path to the project cmake directory. This location will
# first be searched for external CMake packages.
set(CMAKE_MODULE_PATH ${cmake_directory})
#Include the library build configuration. This will also include the custom
# macro defined for the project.
include(build_config)
#Set the location of the library configuration file if it has not already been
# set. This allow the library to be used by an external project without
# overwritting the variable.
if_defined_set(${PROJECT_NAME}_DIR ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
#Load the project configuration file. CMake will search in the directory setted
# above for a module file named simple-libraryConfig.cmake. The configuration
# file will set the different directories and libraries required by the library
find_package(${PROJECT_NAME} REQUIRED)
#Add the project include directory
include_directories(${${PROJECT_NAME}_include_dir})
#Set the source files required to build the library
include(fileList.cmake)
#Build the library
add_library(${PROJECT_NAME} SHARED ${srcs} ${hdrs})
find_package(Boost COMPONENTS system filesystem timer chrono unit_test_framework REQUIRED)
INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIR} )
add_executable(${PROJECT_NAME}_test ${test_sources})
add_executable(pendulumExample ${pendulum_example_sources})
add_executable(largeCircuitExample ${largeCircuit_example_sources})
add_executable(switchableCircuitExample ${switchableCircuit_example_sources})
target_link_libraries(pendulumExample ${PROJECT_NAME})
target_link_libraries(largeCircuitExample ${PROJECT_NAME})
target_link_libraries(switchableCircuitExample ${PROJECT_NAME})
target_link_libraries(${PROJECT_NAME}
${Boost_FILESYSTEM_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${Boost_TIMER_LIBRARY}
${Boost_CHRONO_LIBRARY}
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}
)
target_link_libraries(${PROJECT_NAME}_test
${PROJECT_NAME}
${Boost_FILESYSTEM_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${Boost_TIMER_LIBRARY}
${Boost_CHRONO_LIBRARY}
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}
)