Skip to content

Commit

Permalink
Merge pull request OSGeo#11495 from dg0yt/cmake-fixes
Browse files Browse the repository at this point in the history
Fix CMake find modules
  • Loading branch information
rouault authored Dec 15, 2024
2 parents 109b561 + 632e799 commit 03bd036
Show file tree
Hide file tree
Showing 27 changed files with 43 additions and 23 deletions.
8 changes: 4 additions & 4 deletions cmake/modules/packages/FindCryptoPP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ find_path(CRYPTOPP_INCLUDE_DIR NAMES cryptopp/aes.h HINTS ${CRYPTOPP_HINTPATH}/i

if(CRYPTOPP_INCLUDE_DIR)
if(BUILD_SHARED_LIBS)
find_library(CRYPTOPP_LIBRARY_RELEASE NAMES cryptolib cryptopp HINTS ${CRYPTOPP_HINTPATH}/lib)
find_library(CRYPTOPP_LIBRARY_DEBUG NAMES cryptolibd cryptoppd HINTS ${CRYPTOPP_HINTPATH}/debug)
find_library(CRYPTOPP_LIBRARY_RELEASE NAMES cryptolib cryptopp NAMES_PER_DIR HINTS ${CRYPTOPP_HINTPATH}/lib)
find_library(CRYPTOPP_LIBRARY_DEBUG NAMES cryptolibd cryptoppd NAMES_PER_DIR HINTS ${CRYPTOPP_HINTPATH}/debug)
else()
find_library(CRYPTOPP_LIBRARY_RELEASE NAMES cryptopp HINTS ${CRYPTOPP_HINTPATH}/lib)
find_library(CRYPTOPP_LIBRARY_DEBUG NAMES cryptoppd HINTS ${CRYPTOPP_HINTPATH}/debug)
find_library(CRYPTOPP_LIBRARY_RELEASE NAMES cryptopp NAMES_PER_DIR HINTS ${CRYPTOPP_HINTPATH}/lib)
find_library(CRYPTOPP_LIBRARY_DEBUG NAMES cryptoppd NAMES_PER_DIR HINTS ${CRYPTOPP_HINTPATH}/debug)
endif()
mark_as_advanced(CRYPTOPP_LIBRARY_RELEASE CRYPTOPP_LIBRARY_DEBUG)
include(SelectLibraryConfigurations)
Expand Down
2 changes: 2 additions & 0 deletions cmake/modules/packages/FindDeflate.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@ set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "")
if(NOT Deflate_LIBRARY)
find_library(Deflate_LIBRARY_RELEASE
NAMES ${Deflate_NAMES}
NAMES_PER_DIR
PATH_SUFFIXES lib)
find_library(Deflate_LIBRARY_DEBUG
NAMES ${Deflate_NAMES_DEBUG}
NAMES_PER_DIR
PATH_SUFFIXES lib)

include(SelectLibraryConfigurations)
Expand Down
1 change: 1 addition & 0 deletions cmake/modules/packages/FindFreeXL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ find_path(FREEXL_INCLUDE_DIR
HINTS ${PC_FREEXL_INCLUDE_DIRS})
find_library(FREEXL_LIBRARY
NAMES freexl_i freexl
NAMES_PER_DIR
HINTS ${PC_FREEXL_LIBRARY_DIRS})

mark_as_advanced(FREEXL_INCLUDE_DIR FREEXL_LIBRARY)
Expand Down
1 change: 1 addition & 0 deletions cmake/modules/packages/FindGIF.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ set(POTENTIAL_GIF_LIBS gif libgif ungif libungif giflib giflib4)

find_library(GIF_LIBRARY
NAMES ${POTENTIAL_GIF_LIBS}
NAMES_PER_DIR
HINTS ${GIF_ROOT}
PATH_SUFFIXES lib)

Expand Down
4 changes: 2 additions & 2 deletions cmake/modules/packages/FindGeoTIFF.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ set(GEOTIFF_NAMES ${GEOTIFF_NAMES} geotiff geotiff_i)
set(GEOTIFF_NAMES_DEBUG ${GEOTIFF_NAMES_DEBUG} geotiffd geotiff_d geotiff_d_i)

if(NOT GEOTIFF_LIBRARY)
find_library(GEOTIFF_LIBRARY_RELEASE NAMES ${GEOTIFF_NAMES})
find_library(GEOTIFF_LIBRARY_DEBUG NAMES ${GEOTIFF_NAMES_DEBUG})
find_library(GEOTIFF_LIBRARY_RELEASE NAMES ${GEOTIFF_NAMES} NAMES_PER_DIR)
find_library(GEOTIFF_LIBRARY_DEBUG NAMES ${GEOTIFF_NAMES_DEBUG} NAMES_PER_DIR)
include(SelectLibraryConfigurations)
select_library_configurations(GEOTIFF)
mark_as_advanced(GEOTIFF_LIBRARY_RELEASE GEOTIFF_LIBRARY_DEBUG)
Expand Down
2 changes: 2 additions & 0 deletions cmake/modules/packages/FindHDF4.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,11 @@ if(HDF4_INCLUDE_DIR)
endif()
find_library(HDF4_${tgt}_LIBRARY_DEBUG
NAMES ${_names_debug}
NAMES_PER_DIR
PATHS ${HDF4_PATHS}/lib)
find_library(HDF4_${tgt}_LIBRARY_RELEASE
NAMES ${_names_release}
NAMES_PER_DIR
PATHS ${HDF4_PATHS}/lib)
select_library_configurations(HDF4_${tgt})
mark_as_advanced(HDF4_${tgt}_LIBRARY HDF4_${tgt}_LIBRARY_RELEASE HDF4_${tgt}_LIBRARY_DEBUG )
Expand Down
2 changes: 2 additions & 0 deletions cmake/modules/packages/FindIconv.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,11 @@ endif()

find_library(Iconv_LIBRARY
NAMES ${Iconv_LIBRARY_NAMES}
NAMES_PER_DIR
DOC "iconv library (potentially the C library)")
find_library(Iconv_CHARSET_LIBRARY
NAMES charset libcharset
NAMES_PER_DIR
DOC "iconv on windows has individual libcharset")
mark_as_advanced(Iconv_INCLUDE_DIR)
mark_as_advanced(Iconv_LIBRARY Iconv_CHARSET_LIBRARY)
Expand Down
1 change: 1 addition & 0 deletions cmake/modules/packages/FindJSONC.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ find_path(JSONC_INCLUDE_DIR
PATH_SUFFIXES json-c json)
find_library(JSONC_LIBRARY
NAMES json-c json
NAMES_PER_DIR
HINTS ${PC_JSONC_LIBRARY_DIRS}
${JSONC_ROOT}/lib)
mark_as_advanced(JSONC_LIBRARY JSONC_INCLUDE_DIR)
Expand Down
10 changes: 5 additions & 5 deletions cmake/modules/packages/FindKDU.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ macro(find_kdu_libs_from_makefiles)
set(KDU_VERSION_VAR "${KDU_MAJOR_VERSION}.${KDU_MINOR_VERSION}")

find_library(KDU_LIBRARY ${KDU_SHARED_LIB_NAME}
PATH ${KDU_ROOT}/lib/${ARGV0})
PATHS ${KDU_ROOT}/lib/${ARGV0})
find_library(KDU_AUX_LIBRARY ${KDU_AUX_SHARED_LIB_NAME}
PATH ${KDU_ROOT}/lib/${ARGV0})
PATHS ${KDU_ROOT}/lib/${ARGV0})
endmacro()

set(KDU_VERSION_VAR "")
Expand All @@ -60,15 +60,15 @@ if(KDU_ROOT AND EXISTS "${KDU_ROOT}/coresys")
string(REGEX REPLACE [[.*<ImportLibrary>([^l]*)(lib_x64\\)([^R]*R)(\.lib).*]] "\\1\\2\\3\\4" KDU_AUX_SHARED_LIB_NAME ${MANAGED_MAKEFILE_CONTENTS})

find_library(KDU_LIBRARY ${KDU_SHARED_LIB_NAME}
PATH ${KDU_ROOT})
PATHS ${KDU_ROOT})

find_library(KDU_AUX_LIBRARY ${KDU_AUX_SHARED_LIB_NAME}
PATH ${KDU_ROOT})
PATHS ${KDU_ROOT})
endif()
endif()

find_path(KDU_INCLUDE_DIR coresys/common/kdu_elementary.h
PATH ${KDU_ROOT})
PATHS ${KDU_ROOT})

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(KDU
Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/packages/FindLERC.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The following vars are set if LERC is found.
include(FindPackageHandleStandardArgs)

find_path(LERC_INCLUDE_DIR NAMES Lerc_c_api.h)
find_library(LERC_LIBRARY NAMES Lerc lerc)
find_library(LERC_LIBRARY NAMES Lerc lerc NAMES_PER_DIR)

mark_as_advanced(LERC_INCLUDE_DIR LERC_LIBRARY)
find_package_handle_standard_args(LERC
Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/packages/FindLZ4.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ NOTE: The variables above should not usually be used in CMakeLists.txt files!
### Find library ##############################################################

if(NOT LZ4_LIBRARY)
find_library(LZ4_LIBRARY_RELEASE NAMES lz4 liblz4)
find_library(LZ4_LIBRARY_RELEASE NAMES lz4 liblz4 NAMES_PER_DIR)
find_library(LZ4_LIBRARY_DEBUG NAMES lz4d)

include(SelectLibraryConfigurations)
Expand Down
3 changes: 3 additions & 0 deletions cmake/modules/packages/FindLibKML.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ mark_as_advanced(LIBKML_INCLUDE_DIR)

find_library(LIBKML_BASE_LIBRARY
NAMES kmlbase libkmlbase
NAMES_PER_DIR
HINTS ${PC_LIBKML_LIBRARY_DIRS} )
mark_as_advanced(LIBKML_BASE_LIBRARY)

Expand All @@ -62,6 +63,7 @@ foreach(_comp IN LISTS libkml_known_components)
string(TOLOWER ${_comp} _name)
find_library(LIBKML_${_comp}_LIBRARY
NAMES kml${_name} libkml${_name}
NAMES_PER_DIR
HINTS ${PC_LIBKML_LIBRARY_DIRS} )
mark_as_advanced(LIBKML_${_comp}_LIBRARY)
endif()
Expand All @@ -72,6 +74,7 @@ foreach(_helper IN LISTS libkml_helpers)
string(TOLOWER ${_helper} _name)
find_library(LIBKML_${_helper}_LIBRARY
NAMES ${_name} lib${_name}
NAMES_PER_DIR
HINTS ${PC_LIBKML_LIBRARY_DIRS} )
mark_as_advanced(LIBKML_${_helper}_LIBRARY)
endforeach()
Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/packages/FindMRSID.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ configure
find_path(MRSID_INCLUDE_DIR NAMES lt_base.h)

if( MRSID_INCLUDE_DIR )
find_library( MRSID_LIBRARY NAMES lti_dsdk ltidsdk)
find_library( MRSID_LIBRARY NAMES lti_dsdk ltidsdk NAMES_PER_DIR)
endif()

if(MRSID_INCLUDE_DIR AND MRSID_LIBRARY)
Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/packages/FindMySQL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if( MYSQL_INCLUDE_DIR AND EXISTS "${MYSQL_INCLUDE_DIR}/mysql_version.h" )
"${MYSQL_VERSION_H}" )
endif()

find_library(MYSQL_LIBRARY NAMES mysqlclient mysqlclient_r)
find_library(MYSQL_LIBRARY NAMES mysqlclient mysqlclient_r NAMES_PER_DIR)

if( NOT CMAKE_C_COMPILER_LOADED )
message(AUTHOR_WARNING "C language not enabled: Skipping detection of extra link libraries.")
Expand Down
3 changes: 2 additions & 1 deletion cmake/modules/packages/FindODBC.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ endif()
### Try unixODBC or iODBC in include/lib filesystems ##########################
if (UNIX AND NOT ODBC_CONFIG)
# List names of both ODBC libraries, unixODBC and iODBC
set(_odbc_lib_names odbc;iodbc;unixodbc;)
set(_odbc_lib_names odbc;iodbc;unixodbc)
endif()

### Find include directories ##################################################
Expand All @@ -165,6 +165,7 @@ endif()

find_library(ODBC_LIBRARY
NAMES ${_odbc_lib_names}
NAMES_PER_DIR
PATHS ${_odbc_lib_paths}
PATH_SUFFIXES odbc)

Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/packages/FindOGDI.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ find_path(OGDI_INCLUDE_DIR ecs.h
PATH_SUFFIXES ogdi)
mark_as_advanced(OGDI_INCLUDE_DIR)

find_library(OGDI_LIBRARY NAMES ogdi libogdi)
find_library(OGDI_LIBRARY NAMES ogdi libogdi NAMES_PER_DIR)
mark_as_advanced(OGDI_LIBRARY)

if(OGDI_INCLUDE_DIR AND OGDI_LIBRARY)
Expand Down
1 change: 1 addition & 0 deletions cmake/modules/packages/FindOpenCAD.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ FIND_PATH(OPENCAD_INCLUDE_DIR opencad.h
SET(OPENCAD_NAMES ${OPENCAD_NAMES} opencad opencad_i)
FIND_LIBRARY(OPENCAD_LIBRARY
NAMES ${OPENCAD_NAMES}
NAMES_PER_DIR
PATHS ${OPENCAD_OSGEO4W_HOME}/lib
DOC "Path to OPENCAD library file")

Expand Down
1 change: 1 addition & 0 deletions cmake/modules/packages/FindOracle.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ foreach(_comp IN LISTS Oracle_known_components)
if(_nextcomp GREATER -1)
find_library(Oracle_${_comp}_LIBRARY
NAMES ${Oracle_${_comp}_lib}
NAMES_PER_DIR
PATHS ${ORACLE_LIB_LOCATION}
NO_DEFAULT_PATH
)
Expand Down
4 changes: 2 additions & 2 deletions cmake/modules/packages/FindPROJ.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ set(PROJ_NAMES ${PROJ_NAMES} proj proj_i)
set(PROJ_NAMES_DEBUG ${PROJ_NAMES_DEBUG} projd proj_d)

if(NOT PROJ_LIBRARY)
find_library(PROJ_LIBRARY_RELEASE NAMES ${PROJ_NAMES})
find_library(PROJ_LIBRARY_DEBUG NAMES ${PROJ_NAMES_DEBUG})
find_library(PROJ_LIBRARY_RELEASE NAMES ${PROJ_NAMES} NAMES_PER_DIR)
find_library(PROJ_LIBRARY_DEBUG NAMES ${PROJ_NAMES_DEBUG} NAMES_PER_DIR)
include(SelectLibraryConfigurations)
select_library_configurations(PROJ)
mark_as_advanced(PROJ_LIBRARY_RELEASE PROJ_LIBRARY_DEBUG)
Expand Down
1 change: 1 addition & 0 deletions cmake/modules/packages/FindPodofo.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ find_path(PODOFO_INCLUDE_DIR

find_library(PODOFO_LIBRARY
NAMES podofo libpodofo
NAMES_PER_DIR
HINTS ${PC_PODOFO_LIBRARY_DIRS})

mark_as_advanced(PODOFO_INCLUDE_DIR PODOFO_LIBRARY)
Expand Down
1 change: 1 addition & 0 deletions cmake/modules/packages/FindQHULL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ else()
set(_library_name qhull_r qhullstatic_r)
endif()
find_library(QHULL_LIBRARY NAMES ${_library_name}
NAMES_PER_DIR
HINTS ${PC_QHULL_LIBRARY_DIRS})
unset(_library_name)

Expand Down
4 changes: 2 additions & 2 deletions cmake/modules/packages/FindSFCGAL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ endif()

find_library(SFCGAL_LIBRARY_RELEASE NAMES SFCGAL
HINTS ${SC_SFCGAL_LIBDIR}
PATH ${SFCGAL_ROOT}
PATHS ${SFCGAL_ROOT}
PATH_SUFFIXES lib Lib
)
find_library(SFCGAL_LIBRARY_DEBUG NAMES SFCGALd
HINTS ${SC_SFCGAL_LIBDIR}
PATH ${SFCGAL_ROOT}
PATHS ${SFCGAL_ROOT}
PATH_SUFFIXES lib Lib
)
include(SelectLibraryConfigurations)
Expand Down
1 change: 1 addition & 0 deletions cmake/modules/packages/FindSPATIALITE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ find_path(SPATIALITE_INCLUDE_DIR
PATH_SUFFIXES include)
find_library(SPATIALITE_LIBRARY
NAMES spatialite_i spatialite
NAMES_PER_DIR
HINTS ${SPATIALITE_ROOT} ${PC_SPATIALITE_LIBRARY_DIRS}
PATH_SUFFIXES lib)
mark_as_advanced(SPATIALITE_LIBRARY SPATIALITE_INCLUDE_DIR)
Expand Down
1 change: 1 addition & 0 deletions cmake/modules/packages/FindSQLite3.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ else()
HINTS ${PC_SQLITE3_INCLUDE_DIRS})
find_library(SQLite3_LIBRARY
NAMES sqlite3 sqlite3_i
NAMES_PER_DIR
HINTS ${PC_SQLITE3_LIBRARY_DIRS})
endif()

Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/packages/FindSpatialindex.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#

find_path(SPATIALINDEX_INCLUDE_DIR NAMES SpatialIndex.h PATH_SUFFIXES spatialindex)
find_library(SPATIALINDEX_LIBRARY NAMES spatialindex_i spatialindex)
find_library(SPATIALINDEX_LIBRARY NAMES spatialindex_i spatialindex NAMES_PER_DIR)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Spatialindex FOUND_VAR SPATIALINDEX_FOUND
REQUIRED_VARS SPATIALINDEX_LIBRARY MYSQL_SPATIALINDEX_DIR)
2 changes: 1 addition & 1 deletion cmake/modules/packages/FindWebP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ endif()

find_path(WEBP_INCLUDE_DIR webp/encode.h HINTS ${PC_WEBP_INCLUDE_DIRS})

find_library(WEBP_LIBRARY NAMES webp libwebp HINTS ${PC_WEBP_LIBRARY_DIRS})
find_library(WEBP_LIBRARY NAMES webp libwebp NAMES_PER_DIR HINTS ${PC_WEBP_LIBRARY_DIRS})

mark_as_advanced(WEBP_INCLUDE_DIR WEBP_LIBRARY)

Expand Down
1 change: 1 addition & 0 deletions cmake/modules/thirdparty/FindMono.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ else( UNIX )
find_program(
csharp_mono_compiler # variable is added to the cache, we removed it below
NAMES ${chsarp_mono_names}
NAMES_PER_DIR
PATHS ${csharp_mono_paths}
)

Expand Down

0 comments on commit 03bd036

Please sign in to comment.