Skip to content

Commit 7e108d8

Browse files
committed
Upgraded CMake support files
1 parent 5ada9cb commit 7e108d8

11 files changed

+150
-132
lines changed

config/FindBoost.cmake

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
FindBoost
66
---------
77
8+
.. versionchanged:: 3.30
9+
This module is available only if policy :policy:`CMP0167` is not set to
10+
``NEW``. Port projects to upstream Boost's ``BoostConfig.cmake`` package
11+
configuration file, for which ``find_package(Boost)`` now searches.
12+
813
Find Boost include dirs and libraries
914
1015
Use this module by invoking :command:`find_package` with the form:
@@ -379,6 +384,16 @@ the Boost CMake package configuration for details on what it provides.
379384
Set ``Boost_NO_BOOST_CMAKE`` to ``ON``, to disable the search for boost-cmake.
380385
#]=======================================================================]
381386

387+
cmake_policy(GET CMP0167 _FindBoost_CMP0167)
388+
if(_FindBoost_CMP0167 STREQUAL "NEW")
389+
message(FATAL_ERROR "The FindBoost module has been removed by policy CMP0167.")
390+
endif()
391+
392+
if(_FindBoost_testing)
393+
set(_FindBoost_included TRUE)
394+
return()
395+
endif()
396+
382397
# The FPHSA helper provides standard way of reporting final search results to
383398
# the user including the version and component checks.
384399
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
@@ -387,6 +402,7 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
387402
cmake_policy(PUSH)
388403
cmake_policy(SET CMP0057 NEW) # if IN_LIST
389404
cmake_policy(SET CMP0102 NEW) # if mark_as_advanced(non_cache_var)
405+
cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
390406

391407
function(_boost_get_existing_target component target_var)
392408
set(names "${component}")
@@ -1380,7 +1396,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret)
13801396
set(_Boost_TIMER_DEPENDENCIES chrono)
13811397
set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono atomic)
13821398
set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
1383-
else()
1399+
elseif(Boost_VERSION_STRING VERSION_LESS 1.87.0)
13841400
set(_Boost_CONTRACT_DEPENDENCIES thread chrono)
13851401
set(_Boost_COROUTINE_DEPENDENCIES context)
13861402
set(_Boost_FIBER_DEPENDENCIES context)
@@ -1394,7 +1410,21 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret)
13941410
set(_Boost_THREAD_DEPENDENCIES chrono atomic)
13951411
set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono atomic)
13961412
set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
1397-
if(Boost_VERSION_STRING VERSION_GREATER_EQUAL 1.85.0 AND NOT Boost_NO_WARN_NEW_VERSIONS)
1413+
else()
1414+
set(_Boost_CONTRACT_DEPENDENCIES thread chrono)
1415+
set(_Boost_COROUTINE_DEPENDENCIES context)
1416+
set(_Boost_FIBER_DEPENDENCIES context)
1417+
set(_Boost_IOSTREAMS_DEPENDENCIES regex)
1418+
set(_Boost_JSON_DEPENDENCIES container)
1419+
set(_Boost_LOG_DEPENDENCIES log_setup filesystem thread regex atomic)
1420+
set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l)
1421+
set(_Boost_MPI_DEPENDENCIES serialization)
1422+
set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
1423+
set(_Boost_NUMPY_DEPENDENCIES python${component_python_version})
1424+
set(_Boost_THREAD_DEPENDENCIES chrono atomic)
1425+
set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono atomic)
1426+
set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
1427+
if(Boost_VERSION_STRING VERSION_GREATER_EQUAL 1.88.0 AND NOT Boost_NO_WARN_NEW_VERSIONS)
13981428
message(WARNING "New Boost version may have incorrect or missing dependencies and imported targets")
13991429
endif()
14001430
endif()
@@ -1669,7 +1699,7 @@ else()
16691699
# _Boost_COMPONENT_HEADERS. See the instructions at the top of
16701700
# _Boost_COMPONENT_DEPENDENCIES.
16711701
set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS}
1672-
"1.84.0" "1.84"
1702+
"1.87.0" "1.87" "1.86.0" "1.86" "1.85.0" "1.85" "1.84.0" "1.84"
16731703
"1.83.0" "1.83" "1.82.0" "1.82" "1.81.0" "1.81" "1.80.0" "1.80" "1.79.0" "1.79"
16741704
"1.78.0" "1.78" "1.77.0" "1.77" "1.76.0" "1.76" "1.75.0" "1.75" "1.74.0" "1.74"
16751705
"1.73.0" "1.73" "1.72.0" "1.72" "1.71.0" "1.71" "1.70.0" "1.70" "1.69.0" "1.69"

config/FindICU.cmake

Lines changed: 21 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ platform-specific library name will be automatically selected.
2424
This module reports information about the ICU installation in
2525
several variables. General variables::
2626
27-
ICU_VERSION - ICU release version
2827
ICU_FOUND - true if the main programs and libraries were found
29-
ICU_LIBRARIES - component libraries to be linked
3028
ICU_INCLUDE_DIRS - the directories containing the ICU headers
29+
ICU_LIBRARIES - component libraries to be linked
30+
ICU_VERSION - ICU release version
3131
3232
Imported targets::
3333
@@ -83,12 +83,10 @@ The following cache variables may also be set::
8383
In most cases none of the above variables will require setting,
8484
unless multiple ICU versions are available and a specific version
8585
is required.
86-
87-
Other variables one may set to control this module are::
88-
89-
ICU_DEBUG - Set to ON to enable debug output from FindICU.
9086
#]=======================================================================]
9187

88+
cmake_policy(PUSH)
89+
cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
9290
# Written by Roger Leigh <rleigh@codelibre.net>
9391

9492
set(icu_programs
@@ -136,6 +134,7 @@ function(_ICU_FIND)
136134
HINTS ${icu_roots}
137135
PATH_SUFFIXES ${icu_include_suffixes}
138136
DOC "ICU include directory")
137+
mark_as_advanced(ICU_INCLUDE_DIR)
139138
set(ICU_INCLUDE_DIR "${ICU_INCLUDE_DIR}" PARENT_SCOPE)
140139

141140
# Get version
@@ -178,7 +177,6 @@ function(_ICU_FIND)
178177

179178
# Find all ICU libraries
180179
list(APPEND icu_library_suffixes "${_lib64}" "lib")
181-
set(ICU_REQUIRED_LIBS_FOUND ON)
182180
set(static_prefix )
183181
# static icu libraries compiled with MSVC have the prefix 's'
184182
if(MSVC)
@@ -189,8 +187,9 @@ function(_ICU_FIND)
189187
set(component_cache "ICU_${component_upcase}_LIBRARY")
190188
set(component_cache_release "${component_cache}_RELEASE")
191189
set(component_cache_debug "${component_cache}_DEBUG")
192-
set(component_found "ICU_${component_upcase}_FOUND")
190+
set(component_found "ICU_${component}_FOUND")
193191
set(component_found_compat "${component_upcase}_FOUND")
192+
set(component_found_compat2 "ICU_${component_upcase}_FOUND")
194193
set(component_libnames "icu${component}")
195194
set(component_debug_libnames "icu${component}d")
196195

@@ -253,27 +252,17 @@ function(_ICU_FIND)
253252
if(${component_cache})
254253
set("${component_found}" ON)
255254
set("${component_found_compat}" ON)
255+
set("${component_found_compat2}" ON)
256256
list(APPEND ICU_LIBRARY "${${component_cache}}")
257-
if (ICU_FIND_REQUIRED_${component})
258-
list(APPEND ICU_LIBS_FOUND "${component} (required): ${${component_cache}}")
259-
else()
260-
list(APPEND ICU_LIBS_FOUND "${component} (optional): ${${component_cache}}")
261-
endif()
262-
else()
263-
if (ICU_FIND_REQUIRED_${component})
264-
set(ICU_REQUIRED_LIBS_FOUND OFF)
265-
list(APPEND ICU_LIBS_NOTFOUND "${component} (required)")
266-
else()
267-
list(APPEND ICU_LIBS_NOTFOUND "${component} (optional)")
268-
endif()
269257
endif()
270258
mark_as_advanced("${component_found}")
271259
mark_as_advanced("${component_found_compat}")
260+
mark_as_advanced("${component_found_compat2}")
272261
set("${component_cache}" "${${component_cache}}" PARENT_SCOPE)
273262
set("${component_found}" "${${component_found}}" PARENT_SCOPE)
274263
set("${component_found_compat}" "${${component_found_compat}}" PARENT_SCOPE)
264+
set("${component_found_compat2}" "${${component_found_compat2}}" PARENT_SCOPE)
275265
endforeach()
276-
set(_ICU_REQUIRED_LIBS_FOUND "${ICU_REQUIRED_LIBS_FOUND}" PARENT_SCOPE)
277266
set(ICU_LIBRARY "${ICU_LIBRARY}" PARENT_SCOPE)
278267

279268
# Find all ICU data files
@@ -302,43 +291,21 @@ function(_ICU_FIND)
302291
mark_as_advanced("${cache_var}")
303292
set("${data_var}" "${${cache_var}}" PARENT_SCOPE)
304293
endforeach()
305-
306-
if(NOT ICU_FIND_QUIETLY)
307-
if(ICU_LIBS_FOUND)
308-
message(STATUS "Found the following ICU libraries:")
309-
foreach(found ${ICU_LIBS_FOUND})
310-
message(STATUS " ${found}")
311-
endforeach()
312-
endif()
313-
if(ICU_LIBS_NOTFOUND)
314-
message(STATUS "The following ICU libraries were not found:")
315-
foreach(notfound ${ICU_LIBS_NOTFOUND})
316-
message(STATUS " ${notfound}")
317-
endforeach()
318-
endif()
319-
endif()
320-
321-
if(ICU_DEBUG)
322-
message(STATUS "--------FindICU.cmake search debug--------")
323-
message(STATUS "ICU binary path search order: ${icu_roots}")
324-
message(STATUS "ICU include path search order: ${icu_roots}")
325-
message(STATUS "ICU library path search order: ${icu_roots}")
326-
message(STATUS "----------------")
327-
endif()
328294
endfunction()
329295

330296
_ICU_FIND()
331297

332298
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
333-
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ICU
334-
FOUND_VAR ICU_FOUND
335-
REQUIRED_VARS ICU_INCLUDE_DIR
336-
ICU_LIBRARY
337-
_ICU_REQUIRED_LIBS_FOUND
338-
VERSION_VAR ICU_VERSION
339-
FAIL_MESSAGE "Failed to find all ICU components")
340-
341-
unset(_ICU_REQUIRED_LIBS_FOUND)
299+
find_package_handle_standard_args(ICU
300+
REQUIRED_VARS
301+
ICU_INCLUDE_DIR
302+
ICU_LIBRARY
303+
VERSION_VAR
304+
ICU_VERSION
305+
HANDLE_COMPONENTS
306+
FAIL_MESSAGE
307+
"Failed to find all ICU components"
308+
)
342309

343310
if(ICU_FOUND)
344311
set(ICU_INCLUDE_DIRS "${ICU_INCLUDE_DIR}")
@@ -392,45 +359,5 @@ if(ICU_FOUND)
392359
endforeach()
393360
endif()
394361

395-
if(ICU_DEBUG)
396-
message(STATUS "--------FindICU.cmake results debug--------")
397-
message(STATUS "ICU found: ${ICU_FOUND}")
398-
message(STATUS "ICU_VERSION number: ${ICU_VERSION}")
399-
message(STATUS "ICU_ROOT directory: ${ICU_ROOT}")
400-
message(STATUS "ICU_INCLUDE_DIR directory: ${ICU_INCLUDE_DIR}")
401-
message(STATUS "ICU_LIBRARIES: ${ICU_LIBRARIES}")
402-
403-
foreach(program IN LISTS icu_programs)
404-
string(TOUPPER "${program}" program_upcase)
405-
set(program_lib "ICU_${program_upcase}_EXECUTABLE")
406-
message(STATUS "${program} program: ${program_lib}=${${program_lib}}")
407-
unset(program_upcase)
408-
unset(program_lib)
409-
endforeach()
410-
411-
foreach(data IN LISTS icu_data)
412-
string(TOUPPER "${data}" data_upcase)
413-
string(REPLACE "." "_" data_upcase "${data_upcase}")
414-
set(data_lib "ICU_${data_upcase}")
415-
message(STATUS "${data} data: ${data_lib}=${${data_lib}}")
416-
unset(data_upcase)
417-
unset(data_lib)
418-
endforeach()
419-
420-
foreach(component IN LISTS ICU_FIND_COMPONENTS)
421-
string(TOUPPER "${component}" component_upcase)
422-
set(component_lib "ICU_${component_upcase}_LIBRARIES")
423-
set(component_found "ICU_${component_upcase}_FOUND")
424-
set(component_found_compat "${component_upcase}_FOUND")
425-
message(STATUS "${component} library found: ${component_found}=${${component_found}}")
426-
message(STATUS "${component} library found (compat name): ${component_found_compat}=${${component_found_compat}}")
427-
message(STATUS "${component} library: ${component_lib}=${${component_lib}}")
428-
unset(component_upcase)
429-
unset(component_lib)
430-
unset(component_found)
431-
unset(component_found_compat)
432-
endforeach()
433-
message(STATUS "----------------")
434-
endif()
435-
436362
unset(icu_programs)
363+
cmake_policy(POP)

config/FindPackageHandleStandardArgs.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,9 @@ macro(_FPHSA_FAILURE_MESSAGE _msg)
225225
set (__msg "${_msg}")
226226
if (FPHSA_REASON_FAILURE_MESSAGE)
227227
string(APPEND __msg "\n Reason given by package: ${FPHSA_REASON_FAILURE_MESSAGE}\n")
228+
elseif(NOT DEFINED PROJECT_NAME)
229+
string(APPEND __msg "\n"
230+
"Hint: The project() command has not yet been called. It sets up system-specific search paths.")
228231
endif()
229232
if (${_NAME}_FIND_REQUIRED)
230233
message(FATAL_ERROR "${__msg}")
@@ -342,7 +345,7 @@ function(FIND_PACKAGE_CHECK_VERSION version result)
342345
set(version_msg "Found unsuitable version \"${version}\", but required is exact version \"${${package}_FIND_VERSION}\"")
343346
else ()
344347
set(version_ok TRUE)
345-
set(version_msg "(found suitable exact version \"${_FOUND_VERSION}\")")
348+
set(version_msg "(found suitable exact version \"${version}\")")
346349
endif ()
347350
else ()
348351
if (NOT ${package}_FIND_VERSION VERSION_EQUAL version)

config/FindPackageMessage.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ function(find_package_message pkg msg details)
3737
set(DETAILS_VAR FIND_PACKAGE_MESSAGE_DETAILS_${pkg})
3838
if(NOT "${details}" STREQUAL "${${DETAILS_VAR}}")
3939
# The message has not yet been printed.
40+
string(STRIP "${msg}" msg)
4041
message(STATUS "${msg}")
4142

4243
# Save the find details in the cache to avoid printing the same

0 commit comments

Comments
 (0)