diff --git a/CMakeLists.txt b/CMakeLists.txt index f1dba4dead..2e9665cac4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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} ) diff --git a/cmake/IRODSConfig.cmake.not_yet_installed.in b/cmake/IRODSConfig.cmake.not_yet_installed.in index e6b606afd7..ecbffd83c4 100644 --- a/cmake/IRODSConfig.cmake.not_yet_installed.in +++ b/cmake/IRODSConfig.cmake.not_yet_installed.in @@ -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@") diff --git a/cmake/IRODSTargetsWrapper.cmake b/cmake/IRODSTargetsWrapper.cmake new file mode 100644 index 0000000000..7a40e994f3 --- /dev/null +++ b/cmake/IRODSTargetsWrapper.cmake @@ -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}")