16
16
set (CMAKE_CXX_FLAGS_RELEASE "-O3" )
17
17
endif ()
18
18
19
- # Set compilation flags
20
19
set (CMAKE_BUILD_TYPE Release)
21
20
set (CMAKE_CXX_STANDARD 17) # The vast majority of code is written for C++17 but certain tests require C++20
22
21
set (CMAKE_CXX_STANDARD_REQUIRED True )
@@ -46,24 +45,26 @@ else()
46
45
message (WARNING "OpenMP not found: Multi-threading disabled!" )
47
46
endif ()
48
47
49
- include_directories (
50
- include
51
- )
52
-
53
- # Add executable
54
48
add_library (lbt_obj OBJECT
55
49
src/general/disclaimer.cpp
56
50
src/general/openmp_manager.cpp
57
51
src/general/timer.cpp
58
52
src/general/vtk_utilities.cpp
59
53
src/geometry/vtk_import.cpp
60
54
)
55
+ target_include_directories (lbt_obj PUBLIC
56
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /include >
57
+ $<INSTALL_INTERFACE:include >
58
+ )
59
+
61
60
add_executable (lbt
62
61
$<TARGET_OBJECTS:lbt_obj>
63
62
src/main.cpp
64
63
)
65
-
66
- # Link executable to libraries
64
+ target_include_directories (lbt PUBLIC
65
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /include >
66
+ $<INSTALL_INTERFACE:include >
67
+ )
67
68
set (LBT_LIBRARIES ${VTK_LIBRARIES} nlohmann_json::nlohmann_json)
68
69
if (OpenMP_CXX_FOUND)
69
70
set (LBT_LIBRARIES ${LBT_LIBRARIES} OpenMP::OpenMP_CXX)
@@ -79,7 +80,6 @@ include(GoogleTest)
79
80
if (NOT GTest_FOUND)
80
81
set (LBT_TEST_LIBRARIES ${LBT_LIBRARIES} gtest pthread)
81
82
82
- # Add executable
83
83
add_library (lbt_test_obj OBJECT
84
84
test /constexpr_math/constexpr_math_test.cpp
85
85
test /continuum/simple_continuum_test.cpp
@@ -109,6 +109,10 @@ if (NOT GTest_FOUND)
109
109
test /converter_test.cpp
110
110
test /simulation_test.cpp
111
111
)
112
+ target_include_directories (lbt_test_obj PUBLIC
113
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /include >
114
+ $<INSTALL_INTERFACE:include >
115
+ )
112
116
add_executable (run_lbt_tests
113
117
$<TARGET_OBJECTS:lbt_obj>
114
118
$<TARGET_OBJECTS:lbt_test_obj>
@@ -123,7 +127,6 @@ if (NOT GTest_FOUND)
123
127
)
124
128
set_tests_properties (${noArgsTests} PROPERTIES TIMEOUT 10)
125
129
126
- # Link executable to libraries
127
130
target_link_libraries (lbt_test_obj ${LBT_TEST_LIBRARIES} )
128
131
target_link_libraries (run_lbt_tests ${LBT_TEST_LIBRARIES} )
129
132
else ()
0 commit comments