Skip to content

Commit

Permalink
Complete full implementation of pre-building/pre-installing stages of…
Browse files Browse the repository at this point in the history
… packages (#63)

This commit should complete what is "Use Case 3: Configure/build pointing to a
subset of already installed TriBITS packages in same repo."

To complete this, this commit geneates wrapper <Package>Config.cmake files for
TriBITS-compatible external packages.  This provides the info needed for
downstream internal TriBITS package's <Package>Config.camke files to get the
upstream TriBITS-compatible external package.

This commit makes the earlier test:

  TriBITS_TribitsExampleProject_External_Package_by_Package

fully pass.

However, we need to still add more tests, documentation and error checking but
the initial functionality should be complete.
  • Loading branch information
bartlettroscoe committed Jan 27, 2023
1 parent 49748e3 commit 8b730ed
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tribits/core/package_arch/TribitsProcessEnabledTpls.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ macro(tribits_process_enabled_tribits_compatible_tpl TPL_NAME)
set(TPL_${TPL_NAME}_PARTS_ALREADY_SET FALSE) # ToDo: Take out?
if (NOT TPL_${TPL_NAME}_PARTS_ALREADY_SET)
find_package(${TPL_NAME} CONFIG REQUIRED)
tribits_write_tribits_compatible_external_package_config_file(${TPL_NAME})
tribits_generate_tpl_version_file_and_add_package_config_install_targets(
${TPL_NAME})
set(TPL_${TPL_NAME}_PARTS_ALREADY_SET TRUE)
endif()
endmacro()
Expand Down Expand Up @@ -253,3 +256,28 @@ function(tribits_generate_tpl_version_file_and_add_package_config_install_target
tribits_extpkg_install_config_version_file(${TPL_NAME}
"${tplConfigVersionFile}")
endfunction()


# Generate a <Package>Config.cmake wrapper file for a fully TriBITS-compliant
# external package and put it in the external_packages/ directory so it can be
# included like any external package/TPL.
#
function(tribits_write_tribits_compatible_external_package_config_file tplName)
# Create <tplName>Config.cmake file
set(configFileStr "")
string(APPEND configFileStr
"include(CMakeFindDependencyMacro)\n" )
if (${externalPkg}_DIR)
string(APPEND configFileStr
"set(${tplName}_DIR \"${${tplName}_DIR}\")\n" )
endif()
string(APPEND configFileStr
"find_dependency(${tplName} CONFIG REQUIRED)\n"
)
set(buildDirExternalPkgsDir
"${${PROJECT_NAME}_BINARY_DIR}/${${PROJECT_NAME}_BUILD_DIR_EXTERNAL_PKGS_DIR}")
set(tplConfigFile
"${buildDirExternalPkgsDir}/${tplName}/${tplName}Config.cmake")
file(WRITE "${tplConfigFile}" "${configFileStr}")

endfunction()

0 comments on commit 8b730ed

Please sign in to comment.