Skip to content

Commit

Permalink
Modern way to install headers
Browse files Browse the repository at this point in the history
  • Loading branch information
sanguinariojoe committed Aug 27, 2024
1 parent f9c4179 commit 85b56f6
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions modules/map/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ add_library(mappplib STATIC
src/MAP_Fortran_Types.f90
${MAP_CLIB_SOURCES}
)
target_sources(
mappplib
PUBLIC
$<INSTALL_INTERFACE:MAP_Types.h>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/MAP_Types.h>
$<INSTALL_INTERFACE:mapsys.h>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/mapsys.h>
$<INSTALL_INTERFACE:mapapi.h>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/mapapi.h>
)
target_link_libraries(mappplib nwtclibs)
target_include_directories(mappplib PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/bstring>
Expand All @@ -47,9 +57,8 @@ target_include_directories(mappplib PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/simclist>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
)
set_target_properties(mappplib PROPERTIES PUBLIC_HEADER src/MAP_Types.h
src/mapsys.h
src/mapapi.h)
get_target_property(MAPPP_PUBLIC_HEADERS mappplib INTERFACE_SOURCES)
set_target_properties(mappplib PROPERTIES PUBLIC_HEADER "${MAPPP_PUBLIC_HEADERS}")

install(TARGETS mappplib
EXPORT "${CMAKE_PROJECT_NAME}Libraries"
Expand Down

0 comments on commit 85b56f6

Please sign in to comment.