Skip to content

Commit

Permalink
Use header file sets while installing CMake targets (#242 | GRIDEDIT-…
Browse files Browse the repository at this point in the history
…740)
  • Loading branch information
ahmad-el-sayed authored Oct 16, 2023
1 parent 9db2f18 commit 5f22543
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 18 deletions.
20 changes: 6 additions & 14 deletions libs/MeshKernel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,6 @@ set(
${UTILITIES_INC_DIR}/RTree.hpp
)

set(
HEADERS
${INC_LIST}
${AVERAGING_STRATEGIES_INC_LIST}
${CURVILINEAR_GRID_INC_LIST}
${UTILITIES_INC_LIST}
)

# add sources to target
target_sources(
${TARGET_NAME}
Expand All @@ -193,14 +185,14 @@ target_sources(
BASE_DIRS
${INC_DIR}
FILES
${HEADERS}
${INC_LIST}
${AVERAGING_STRATEGIES_INC_LIST}
${CURVILINEAR_GRID_INC_LIST}
${UTILITIES_INC_LIST}
)

# set the public headers
set_target_properties(${TARGET_NAME} PROPERTIES PUBLIC_HEADER "${HEADERS}")

# Expose the interface of the static lib
target_include_directories( ${TARGET_NAME} PUBLIC ${INC_DIR})
target_include_directories(${TARGET_NAME} PUBLIC ${INC_DIR})

# Add target link dependencies

Expand Down Expand Up @@ -261,7 +253,7 @@ target_precompile_headers(
<vector>
)

install(TARGETS ${TARGET_NAME} PUBLIC_HEADER DESTINATION "include/MeshKernel")
install(TARGETS ${TARGET_NAME} FILE_SET HEADERS DESTINATION "include")

# group the sources in IDE tree
source_group("Source Files" FILES ${SRC_LIST})
Expand Down
5 changes: 1 addition & 4 deletions libs/MeshKernelApi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ target_sources(
${INC_LIST}
)

# define the public header
set_target_properties(${TARGET_NAME} PROPERTIES PUBLIC_HEADER "${INC_LIST}")

# Expose the interface of the shared lib
target_include_directories(${TARGET_NAME} PUBLIC ${INC_DIR})

Expand Down Expand Up @@ -83,7 +80,7 @@ target_precompile_headers(
<vector>
)

install(TARGETS ${TARGET_NAME} PUBLIC_HEADER DESTINATION "include/MeshKernelApi")
install(TARGETS ${TARGET_NAME} FILE_SET HEADERS DESTINATION "include")

# group the sources in IDE tree
source_group("Source Files" FILES ${SRC_LIST})
Expand Down

0 comments on commit 5f22543

Please sign in to comment.