Skip to content

Commit e99120b

Browse files
committed
header only lib
1 parent 58243b3 commit e99120b

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

CMakeLists.txt

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,26 @@ set_property(TARGET Omega_h::omega_h PROPERTY INTERFACE_COMPILE_OPTIONS "")
99

1010
find_package(Cabana REQUIRED)
1111

12+
#create header only library
13+
add_library(meshFields INTERFACE)
14+
target_include_directories(meshFields INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/src)
15+
target_link_libraries(meshFields INTERFACE Omega_h::omega_h)
16+
target_link_libraries(meshFields INTERFACE Cabana::cabanacore)
17+
target_compile_definitions(meshFields INTERFACE ENABLE_CABANA) #SHOULD THIS BE PUBLIC?
18+
1219
#Settings options for testing
1320
enable_testing()
1421
include(CTest)
1522

1623
option(IS_TESTING "Build for CTest" OFF)
1724
message(STATUS "IS_TESTING: ${IS_TESTING}")
1825

26+
#tests
1927
add_executable(SliceWrapper test/testSliceWrapper.cpp)
20-
target_include_directories(SliceWrapper PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src) #hack - this should be a header-only library
21-
target_link_libraries(SliceWrapper Omega_h::omega_h)
22-
target_link_libraries(SliceWrapper Cabana::cabanacore)
23-
target_compile_definitions(SliceWrapper PUBLIC ENABLE_CABANA)
28+
target_link_libraries(SliceWrapper PRIVATE meshFields)
2429

2530
add_executable(MeshField test/testMeshField.cpp)
26-
target_include_directories(MeshField PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src) #hack - this should be a header-only library
27-
target_link_libraries(MeshField Omega_h::omega_h)
28-
target_link_libraries(MeshField Cabana::cabanacore)
29-
target_compile_definitions(MeshField PUBLIC ENABLE_CABANA)
31+
target_link_libraries(SliceWrapper PRIVATE meshFields)
3032

3133
add_test(sliceWrapper50 ./SliceWrapper 50)
3234
add_test(meshField ./MeshField)

0 commit comments

Comments
 (0)