@@ -24,10 +24,10 @@ platform-specific library name will be automatically selected.
24
24
This module reports information about the ICU installation in
25
25
several variables. General variables::
26
26
27
- ICU_VERSION - ICU release version
28
27
ICU_FOUND - true if the main programs and libraries were found
29
- ICU_LIBRARIES - component libraries to be linked
30
28
ICU_INCLUDE_DIRS - the directories containing the ICU headers
29
+ ICU_LIBRARIES - component libraries to be linked
30
+ ICU_VERSION - ICU release version
31
31
32
32
Imported targets::
33
33
@@ -83,12 +83,10 @@ The following cache variables may also be set::
83
83
In most cases none of the above variables will require setting,
84
84
unless multiple ICU versions are available and a specific version
85
85
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.
90
86
#]=======================================================================]
91
87
88
+ cmake_policy (PUSH )
89
+ cmake_policy (SET CMP0159 NEW ) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
92
90
# Written by Roger Leigh <rleigh@codelibre.net>
93
91
94
92
set (icu_programs
@@ -136,6 +134,7 @@ function(_ICU_FIND)
136
134
HINTS ${icu_roots}
137
135
PATH_SUFFIXES ${icu_include_suffixes}
138
136
DOC "ICU include directory" )
137
+ mark_as_advanced (ICU_INCLUDE_DIR )
139
138
set (ICU_INCLUDE_DIR "${ICU_INCLUDE_DIR} " PARENT_SCOPE )
140
139
141
140
# Get version
@@ -178,7 +177,6 @@ function(_ICU_FIND)
178
177
179
178
# Find all ICU libraries
180
179
list (APPEND icu_library_suffixes "${_lib64} " "lib" )
181
- set (ICU_REQUIRED_LIBS_FOUND ON )
182
180
set (static_prefix )
183
181
# static icu libraries compiled with MSVC have the prefix 's'
184
182
if (MSVC )
@@ -189,8 +187,9 @@ function(_ICU_FIND)
189
187
set (component_cache "ICU_${component_upcase} _LIBRARY" )
190
188
set (component_cache_release "${component_cache} _RELEASE" )
191
189
set (component_cache_debug "${component_cache} _DEBUG" )
192
- set (component_found "ICU_${component_upcase } _FOUND" )
190
+ set (component_found "ICU_${component } _FOUND" )
193
191
set (component_found_compat "${component_upcase} _FOUND" )
192
+ set (component_found_compat2 "ICU_${component_upcase} _FOUND" )
194
193
set (component_libnames "icu${component} " )
195
194
set (component_debug_libnames "icu${component} d" )
196
195
@@ -253,27 +252,17 @@ function(_ICU_FIND)
253
252
if (${component_cache} )
254
253
set ("${component_found} " ON )
255
254
set ("${component_found_compat} " ON )
255
+ set ("${component_found_compat2} " ON )
256
256
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 ()
269
257
endif ()
270
258
mark_as_advanced ("${component_found} " )
271
259
mark_as_advanced ("${component_found_compat} " )
260
+ mark_as_advanced ("${component_found_compat2} " )
272
261
set ("${component_cache} " "${${component_cache} }" PARENT_SCOPE )
273
262
set ("${component_found} " "${${component_found} }" PARENT_SCOPE )
274
263
set ("${component_found_compat} " "${${component_found_compat} }" PARENT_SCOPE )
264
+ set ("${component_found_compat2} " "${${component_found_compat2} }" PARENT_SCOPE )
275
265
endforeach ()
276
- set (_ICU_REQUIRED_LIBS_FOUND "${ICU_REQUIRED_LIBS_FOUND} " PARENT_SCOPE )
277
266
set (ICU_LIBRARY "${ICU_LIBRARY} " PARENT_SCOPE )
278
267
279
268
# Find all ICU data files
@@ -302,43 +291,21 @@ function(_ICU_FIND)
302
291
mark_as_advanced ("${cache_var} " )
303
292
set ("${data_var} " "${${cache_var} }" PARENT_SCOPE )
304
293
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 ()
328
294
endfunction ()
329
295
330
296
_ICU_FIND ()
331
297
332
298
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
+ )
342
309
343
310
if (ICU_FOUND )
344
311
set (ICU_INCLUDE_DIRS "${ICU_INCLUDE_DIR} " )
@@ -392,45 +359,5 @@ if(ICU_FOUND)
392
359
endforeach ()
393
360
endif ()
394
361
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
-
436
362
unset (icu_programs )
363
+ cmake_policy (POP )
0 commit comments