Skip to content

Commit 5cc6d61

Browse files
committed
header only lib
1 parent ac3d9ff commit 5cc6d61

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

CMakeLists.txt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,23 @@ 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/SliceWrapper.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/MeshField.cpp)
2631
target_include_directories(MeshField PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src) #hack - this should be a header-only library

0 commit comments

Comments
 (0)