From 92f183af49740154f33688695b254832ec50a561 Mon Sep 17 00:00:00 2001 From: Joris Clement Date: Fri, 28 Oct 2022 17:22:47 +0200 Subject: Fix CMake warning The warnings occurs at least with CMake version 3.24. It is caused by CMake trying to find the gcc library due to case sensitivity. The warning message was: ``` CMake Warning (dev) at /usr/share/cmake-3.24/Modules/FindPackageHandleStandardArgs.cmake:438 (message): The package name passed to `find_package_handle_standard_args` (LIBGCC) does not match the name of the calling package (LibGCC). This can lead to problems in calling code that expects `find_package` result variables (e.g., `_FOUND`) to follow a certain pattern. Call Stack (most recent call first): build/cmake/FindLibGCC.cmake:17 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) CMakeLists.txt:1269 (FIND_PACKAGE) This warning is for project developers. Use -Wno-dev to suppress it. ``` --- CMakeLists.txt | 7 ++++--- build/cmake/FindLIBGCC.cmake | 22 ++++++++++++++++++++++ build/cmake/FindLibGCC.cmake | 22 ---------------------- 3 files changed, 26 insertions(+), 25 deletions(-) create mode 100644 build/cmake/FindLIBGCC.cmake delete mode 100644 build/cmake/FindLibGCC.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index e3bb6591..1130b8c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -213,7 +213,7 @@ OPTION(ENABLE_BZip2 "Enable the use of the system BZip2 library if found" ON) OPTION(ENABLE_LIBXML2 "Enable the use of the system libxml2 library if found" ON) OPTION(ENABLE_EXPAT "Enable the use of the system EXPAT library if found" ON) OPTION(ENABLE_PCREPOSIX "Enable the use of the system PCREPOSIX library if found" ON) -OPTION(ENABLE_LibGCC "Enable the use of the system LibGCC library if found" ON) +OPTION(ENABLE_LIBGCC "Enable the use of the system LibGCC library if found" ON) # CNG is used for encrypt/decrypt Zip archives on Windows. OPTION(ENABLE_CNG "Enable the use of CNG(Crypto Next Generation)" ON) @@ -1264,9 +1264,10 @@ IF(NOT FOUND_POSIX_REGEX_LIB AND POSIX_REGEX_LIB MATCHES "^(AUTO|LIBPCREPOSIX)$" # # If requested, try finding library for PCREPOSIX # - IF(ENABLE_LibGCC) - FIND_PACKAGE(LibGCC) + IF(ENABLE_LIBGCC) + FIND_PACKAGE(LIBGCC) ELSE() + MESSAGE(FATAL_ERROR "libgcc not found.") SET(LIBGCC_FOUND FALSE) # Override cached value ENDIF() IF(ENABLE_PCREPOSIX) diff --git a/build/cmake/FindLIBGCC.cmake b/build/cmake/FindLIBGCC.cmake new file mode 100644 index 00000000..5883ff80 --- /dev/null +++ b/build/cmake/FindLIBGCC.cmake @@ -0,0 +1,22 @@ +# - Find libgcc +# Find the libgcc library. +# +# LIBGCC_LIBRARIES - List of libraries when using libgcc +# LIBGCC_FOUND - True if libgcc found. + +IF (LIBGCC_LIBRARY) + # Already in cache, be silent + SET(LIBGCC_FIND_QUIETLY TRUE) +ENDIF (LIBGCC_LIBRARY) + +FIND_LIBRARY(LIBGCC_LIBRARY NAMES gcc libgcc) + +# handle the QUIETLY and REQUIRED arguments and set LIBGCC_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBGCC DEFAULT_MSG LIBGCC_LIBRARY) + +IF(LIBGCC_FOUND) + SET(LIBGCC_LIBRARIES ${LIBGCC_LIBRARY}) + SET(HAVE_LIBGCC 1) +ENDIF(LIBGCC_FOUND) diff --git a/build/cmake/FindLibGCC.cmake b/build/cmake/FindLibGCC.cmake deleted file mode 100644 index 5883ff80..00000000 --- a/build/cmake/FindLibGCC.cmake +++ /dev/null @@ -1,22 +0,0 @@ -# - Find libgcc -# Find the libgcc library. -# -# LIBGCC_LIBRARIES - List of libraries when using libgcc -# LIBGCC_FOUND - True if libgcc found. - -IF (LIBGCC_LIBRARY) - # Already in cache, be silent - SET(LIBGCC_FIND_QUIETLY TRUE) -ENDIF (LIBGCC_LIBRARY) - -FIND_LIBRARY(LIBGCC_LIBRARY NAMES gcc libgcc) - -# handle the QUIETLY and REQUIRED arguments and set LIBGCC_FOUND to TRUE if -# all listed variables are TRUE -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBGCC DEFAULT_MSG LIBGCC_LIBRARY) - -IF(LIBGCC_FOUND) - SET(LIBGCC_LIBRARIES ${LIBGCC_LIBRARY}) - SET(HAVE_LIBGCC 1) -ENDIF(LIBGCC_FOUND) -- cgit v1.2.1