Skip to content

Commit

Permalink
[irods#7398] add find_dependency calls to a wrapper around our CMake …
Browse files Browse the repository at this point in the history
…targets file
  • Loading branch information
SwooshyCueb authored and alanking committed Feb 20, 2024
1 parent 0ed7590 commit b799951
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ write_basic_package_version_file(
install(
FILES
"${CMAKE_IRODS_BINARY_DIR}/IRODSConfigVersion.cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/IRODSTargetsWrapper.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/irods/cmake"
COMPONENT ${IRODS_PACKAGE_COMPONENT_DEVELOPMENT_NAME}
)
Expand Down
3 changes: 2 additions & 1 deletion cmake/IRODSConfig.cmake.not_yet_installed.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_LIST_DIR}/Modules")

set_and_check(IRODS_TARGETS_PATH "${CMAKE_CURRENT_LIST_DIR}/IRODSTargets.cmake")
set_and_check(IRODS_TARGETS_PATH "${CMAKE_CURRENT_LIST_DIR}/IRODSTargetsWrapper.cmake")
set_and_check(IRODS_TARGETS_PATH_UNWRAPPED "${CMAKE_CURRENT_LIST_DIR}/IRODSTargets.cmake")

if(NOT DEFINED IRODS_BUILD_WITH_CLANG)
set(IRODS_BUILD_WITH_CLANG "@IRODS_BUILD_WITH_CLANG@")
Expand Down
27 changes: 27 additions & 0 deletions cmake/IRODSTargetsWrapper.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# We can't define targets in our config file because the variables it defines
# and the modules it adds to the search path need to be available before any
# languages are enabled.
# This is because we bundle a module to set the compilers to the clang we
# provide via externals, and downstream projects which use this module must
# include it before languages are enabled.
# Therefore, we do not include our targets file in our CMake configuration
# file, we have a wrapper for our targets file that pulls in our dependencies,
# and we define a variable to make including our targets file
# easy for downstream projects.
# Yes, this is icky. We plan to move away from this model eventually.

include(CMakeFindDependencyMacro)

if (NOT DEFINED THREADS_PREFER_PTHREAD_FLAG)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
endif()
find_dependency(Threads)

find_dependency(nlohmann_json "3.6.1")
find_dependency(OpenSSL COMPONENTS Crypto SSL)
find_dependency(fmt "8.1.1"
HINTS "${IRODS_EXTERNALS_FULLPATH_FMT}")
find_dependency(spdlog "1.9.2"
HINTS "${IRODS_EXTERNALS_FULLPATH_SPDLOG}")

include("${IRODS_TARGETS_PATH_UNWRAPPED}")

0 comments on commit b799951

Please sign in to comment.