From f5f58fb7e1bf2561eb161beb29fbed4db23ae9ab Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Fri, 1 Nov 2024 10:56:09 -0600 Subject: [PATCH 1/5] Complete renaming of PythonInterp_FIND_VERSION to _Python3_FIND_VERSION (#610) I somehow missed this in the previous commit: 3e5471dc "Change to find_package(Python3), set Python3_EXECUTABLE to PYTHON_EXECUTABLE (#610)" Author: Roscoe A. Bartlett Date: Thu Oct 3 12:03:52 2024 -0600 (4 weeks ago) Signed-off-by: Roscoe A. Bartlett --- .../guides/TribitsCoreDetailedReference.rst | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/tribits/doc/guides/TribitsCoreDetailedReference.rst b/tribits/doc/guides/TribitsCoreDetailedReference.rst index aa443415c..1f07e959e 100644 --- a/tribits/doc/guides/TribitsCoreDetailedReference.rst +++ b/tribits/doc/guides/TribitsCoreDetailedReference.rst @@ -86,6 +86,7 @@ a given TriBITS project are: * `${PROJECT_NAME}_MAKE_INSTALL_GROUP_WRITABLE`_ * `${PROJECT_NAME}_MAKE_INSTALL_WORLD_READABLE`_ * `${PROJECT_NAME}_MUST_FIND_ALL_TPL_LIBS`_ +* `${PROJECT_NAME}_Python3_FIND_VERSION`_ * `${PROJECT_NAME}_REQUIRES_PYTHON`_ * `${PROJECT_NAME}_SET_INSTALL_RPATH`_ * `${PROJECT_NAME}_SHOW_GIT_COMMIT_PARENTS`_ @@ -99,7 +100,6 @@ a given TriBITS project are: * `DART_TESTING_TIMEOUT`_ * `CMAKE_INSTALL_RPATH_USE_LINK_PATH`_ * `MPI_EXEC_MAX_NUMPROCS`_ -* `PythonInterp_FIND_VERSION`_ * `TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE`_ These options are described below. @@ -625,6 +625,23 @@ These options are described below. in the `/ProjectName.cmake`_ file. +.. _${PROJECT_NAME}_Python3_FIND_VERSION: + +**${PROJECT_NAME}_Python3_FIND_VERSION** + + Determines the version of Python that is looked for. TriBITS requires at + least version "3.6". A particular TriBITS project can require a higher + version of TriBITS and this is set using, for example: + + set(${PROJECT_NAME}_Python3_FIND_VERSION_DEFAULT "3.8") + + in the `/ProjectName.cmake`_ file (See `Python Support`_). The + user can force a more recent version of Python by configuring with, for + example:: + + -D _Python3_FIND_VERSION="3.8" + + .. _${PROJECT_NAME}_REQUIRES_PYTHON: **${PROJECT_NAME}_REQUIRES_PYTHON** @@ -877,22 +894,6 @@ These options are described below. has 64 cores, a reasonable number for ``MPI_EXEC_MAX_NUMPROCS_DEFAULT`` is 64. -.. _PythonInterp_FIND_VERSION: - -**PythonInterp_FIND_VERSION** - - Determines the version of Python that is looked for. TriBITS requires at - least version "2.7". A particular TriBITS project can require a higher - version of TriBITS and this is set using, for example: - - set(PythonInterp_FIND_VERSION_DEFAULT "3.5.2") - - in the `/ProjectName.cmake`_ file (See `Python Support`_). The - default is version "2.7". The user can force a more recent version of - Python by configuring with, for example:: - - -D PythonInterp_FIND_VERSION="3.6.2" - .. _TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE: **TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE** From 3bc6bcd1619890e4b71afb2b8f227bb574810a5c Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Fri, 1 Nov 2024 06:56:13 -0600 Subject: [PATCH 2/5] Explicitly set vars to empty "" I just noticed this when looking over this code. Signed-off-by: Roscoe A. Bartlett --- .../package_arch/TribitsTplFindIncludeDirsAndLibraries.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tribits/core/package_arch/TribitsTplFindIncludeDirsAndLibraries.cmake b/tribits/core/package_arch/TribitsTplFindIncludeDirsAndLibraries.cmake index 54f08d60f..3ac3bdd66 100644 --- a/tribits/core/package_arch/TribitsTplFindIncludeDirsAndLibraries.cmake +++ b/tribits/core/package_arch/TribitsTplFindIncludeDirsAndLibraries.cmake @@ -425,7 +425,7 @@ function(tribits_tpl_find_include_dirs_and_libraries TPL_NAME) message( "-- Searching for libs in ${TPL_NAME}_LIBRARY_DIRS='${${TPL_NAME}_LIBRARY_DIRS}'") - set(LIBRARIES_FOUND) + set(LIBRARIES_FOUND "") foreach(LIBNAME_SET ${REQUIRED_LIBS_NAMES}) @@ -438,7 +438,7 @@ function(tribits_tpl_find_include_dirs_and_libraries TPL_NAME) set(LIBNAME_LIST ${LIBNAME_SET}) separate_arguments(LIBNAME_LIST) - set(LIBNAME_SET_LIB) + set(LIBNAME_SET_LIB "") foreach(LIBNAME ${LIBNAME_LIST}) From 44df3a4b60d53d4286217a0a23bac0639e92810c Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Fri, 1 Nov 2024 10:35:34 -0600 Subject: [PATCH 3/5] Update doc for REQUIRED_LIBS_NAMES Signed-off-by: Roscoe A. Bartlett --- ...ribitsTplFindIncludeDirsAndLibraries.cmake | 36 ++++++++++++++++--- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/tribits/core/package_arch/TribitsTplFindIncludeDirsAndLibraries.cmake b/tribits/core/package_arch/TribitsTplFindIncludeDirsAndLibraries.cmake index 3ac3bdd66..722d0710a 100644 --- a/tribits/core/package_arch/TribitsTplFindIncludeDirsAndLibraries.cmake +++ b/tribits/core/package_arch/TribitsTplFindIncludeDirsAndLibraries.cmake @@ -141,7 +141,7 @@ endfunction() # # [REQUIRED_HEADERS ...] # [MUST_FIND_ALL_HEADERS] -# [REQUIRED_LIBS_NAMES ...] +# [REQUIRED_LIBS_NAMES " ..." ...] # [MUST_FIND_ALL_LIBS] # [NO_PRINT_ENABLE_SUCCESS_FAIL] # ) @@ -165,11 +165,36 @@ endfunction() # If set, then all of the header files listed in ``REQUIRED_HEADERS`` must # be found (unless ``TPL__INCLUDE_DIRS`` is already set). # -# ``REQUIRED_LIBS_NAMES`` +# ``REQUIRED_LIBS_NAMES " ..." ...`` # # List of libraries that are searched for when looking for the TPL's -# libraries using ``find_library()``. This list can be overridden by the -# user by setting ``_LIBRARY_NAMES`` (see below). +# libraries using ``find_library()``. A single list of library names of +# the form: +# +# `` ...`` +# +# are searched for and must all be found and will define the libraries for +# this TPL on the link line in that order. However, a library name along +# with alternate library names can be provided using outer quotes with +# inner spaces: +# +# ``" ..."`` +# +# In this case, first, ```` is looked for and used if it is +# found. If not found, then the next alternate library name +# ```` is looked for and is used if found. This continues +# with each successive alternate library name in the set until one is +# found. If none of the libraries in the set alternative names are found, +# then this is an error. Providing a set of alternate library names (in +# order of preference) allows the default find operation to look for +# different library names for different situations and implementations. +# For example, the BLAS library can be called ``blas``, ``openblas`` or +# ``atlas`` for different BLAS implementations and can be specified as: +# +# ``"blas openblas atlas"`` +# +# The list of required library names can be overridden by the user by +# setting ``_LIBRARY_NAMES`` (see below). # # ``MUST_FIND_ALL_LIBS`` # @@ -206,7 +231,8 @@ endfunction() # ``_LIBRARY_NAMES`` (type ``STRING``) # # List of library names to be looked for instead of what is specified in -# ``REQUIRED_LIBS_NAMES ...``. +# ``REQUIRED_LIBS_NAMES ...``. If set, only a +# single set of libraries can be specified of which all need to be found. # # ``_LIB_ENABLED_DEPENDENCIES`` # From 410ffb3df49eb10a0387ec7d802e113cc6a48786 Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Fri, 1 Nov 2024 11:45:22 -0600 Subject: [PATCH 4/5] Add hyperlinks to TriBITS FindTPL.cmake impl functions I was noticing that there was no hyperlinks to get from the documentation for FindTPL.cmake to these functions and I had to resort to dumb browser searches. Signed-off-by: Roscoe A. Bartlett --- tribits/doc/guides/TribitsGuidesBody.rst | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tribits/doc/guides/TribitsGuidesBody.rst b/tribits/doc/guides/TribitsGuidesBody.rst index 29a319fc6..b002cbc80 100644 --- a/tribits/doc/guides/TribitsGuidesBody.rst +++ b/tribits/doc/guides/TribitsGuidesBody.rst @@ -2006,7 +2006,9 @@ FindTPL.cmake modules`_). The form of a simple ``FindTPL.cmake`` file that uses an internal call to ``find_package()`` which provides modern IMPORTED CMake -targets looks like:: +targets can use the +`tribits_extpkg_create_imported_all_libs_target_and_config_file()`_ function +and looks like:: find_package( REQUIRED) tribits_extpkg_create_imported_all_libs_target_and_config_file( @@ -2014,7 +2016,7 @@ targets looks like:: INNER_FIND_PACKAGE_NAME IMPORTED_TARGETS_FOR_ALL_LIBS ... ) -In this case, the purpose for the ``FindTPL.cmake`` file (as apposed +In this case, the purpose for the ``FindTPL.cmake`` file (as opposed to a direct call to ``find_package()``) is to ensure the definition of the complete target ``::all_libs`` which contains all usage requirements for the external package/TPL (i.e. all of the libraries, @@ -2023,7 +2025,8 @@ file ``Config.cmake``. The form of a simple ``FindTPL.cmake`` file that just provides a list of required header files and libraries that does **not** use an internal call -to ``find_package()`` looks like:: +to ``find_package()`` and instead uses the function +`tribits_tpl_find_include_dirs_and_libraries()`_ looks like:: tribits_tpl_find_include_dirs_and_libraries( REQUIRED_HEADERS ... From ca6ea52e3293bbc6b637fbf7d4aadce75e6648d1 Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Fri, 1 Nov 2024 11:46:17 -0600 Subject: [PATCH 5/5] Update howto with alternative lib names with tribits_tpl_find_include_dirs_and_libraries() Signed-off-by: Roscoe A. Bartlett --- tribits/doc/guides/TribitsGuidesBody.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tribits/doc/guides/TribitsGuidesBody.rst b/tribits/doc/guides/TribitsGuidesBody.rst index b002cbc80..bcd68bed1 100644 --- a/tribits/doc/guides/TribitsGuidesBody.rst +++ b/tribits/doc/guides/TribitsGuidesBody.rst @@ -5942,6 +5942,22 @@ header files and libraries that must be found. A simple MUST_FIND_ALL_LIBS ) +Note that a set of alternate names for each library can be specified using +quotes around the set of alternative library names using the syntax:: + + tribits_tpl_find_include_dirs_and_libraries( + ... + REQUIRED_LIBS_NAMES " ..." ... + ... + ) + +This is most commonly used for simple single-library TPLs like BLAS that has +different potential implementations like:: + + tribits_tpl_find_include_dirs_and_libraries( BLAS + REQUIRED_LIBS_NAMES "blas openblas atlas" + ... + ) Requirements for FindTPL.cmake modules +++++++++++++++++++++++++++++++++++++++++++++++