Skip to content

Commit

Permalink
cmake: revert some changes; include UDUNITS2_INCLUDE at compiler level
Browse files Browse the repository at this point in the history
  • Loading branch information
program-- committed Sep 8, 2023
1 parent a04cde6 commit 4064d11
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 2 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,9 @@ if(NGEN_WITH_UDUNITS)
# Create UDUNITS2 target
# Note: GLOBAL is required here in order to extend the scope of the target.
# see: https://stackoverflow.com/a/46491758/6891484
add_library(libudunits2::library SHARED IMPORTED GLOBAL)
set_target_properties(libudunits2::library PROPERTIES IMPORTED_LOCATION "${UDUNITS2_LIBRARY}")

add_library(libudunits2 INTERFACE IMPORTED)
add_library(libudunits2 SHARED IMPORTED GLOBAL)
set_target_properties(libudunits2 PROPERTIES IMPORTED_LOCATION "${UDUNITS2_LIBRARY}")
target_include_directories(libudunits2 INTERFACE "${UDUNITS2_INCLUDE}")
target_link_libraries(libudunits2 INTERFACE libudunits2::library)

get_target_property(_SUMMARY_UDUNITS_INCLUDE libudunits2 INTERFACE_INCLUDE_DIRECTORIES)
endif()
Expand Down
5 changes: 5 additions & 0 deletions cmake/FindUDUNITS2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@ endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(UDUNITS2 DEFAULT_MSG UDUNITS2_LIBRARY UDUNITS2_INCLUDE)

# Based on: https://stackoverflow.com/questions/26834553/osx-10-10-cmake-3-0-2-and-clang-wont-find-local-headers
if(UDUNITS2_FOUND)
include_directories(${UDUNITS2_INCLUDE})
endif()

0 comments on commit 4064d11

Please sign in to comment.