From 273c3f1e079cb832000d77a8d804d4653fb8b78f Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Wed, 20 Nov 2024 21:20:07 +0100 Subject: [PATCH 1/2] MSVC 64-bit cleanup --- cmake/modules/packages/FindDB2.cmake | 2 +- frmts/gtiff/libtiff/CMakeLists.txt | 6 ------ gdal.cmake | 3 --- port/CMakeLists.txt | 6 +----- 4 files changed, 2 insertions(+), 15 deletions(-) diff --git a/cmake/modules/packages/FindDB2.cmake b/cmake/modules/packages/FindDB2.cmake index 2fd2324b4a6e..a18b7777279e 100644 --- a/cmake/modules/packages/FindDB2.cmake +++ b/cmake/modules/packages/FindDB2.cmake @@ -46,7 +46,7 @@ if(UNIX) endforeach(db2_libdir) endforeach(db2_install_path) elseif(WIN32) - if (CMAKE_CL_64) # 64-bit build, DB2 64-bit installed + if (CMAKE_SIZEOF_VOID_P EQUAL "8") # 64-bit build, DB2 64-bit installed set(DB2_FIND_INCLUDE_PATHS $ENV{ProgramW6432}/IBM/SQLLIB/include) set(DB2_FIND_LIB_PATHS $ENV{ProgramW6432}/IBM/SQLLIB/lib) else() # 32-bit build, DB2 64-bit or DB2 32-bit installed diff --git a/frmts/gtiff/libtiff/CMakeLists.txt b/frmts/gtiff/libtiff/CMakeLists.txt index ae4503f7ea3f..8f879d55518e 100644 --- a/frmts/gtiff/libtiff/CMakeLists.txt +++ b/frmts/gtiff/libtiff/CMakeLists.txt @@ -154,12 +154,6 @@ if (RENAME_INTERNAL_TIFF_SYMBOLS) target_compile_definitions(libtiff PUBLIC -DRENAME_INTERNAL_LIBTIFF_SYMBOLS) endif () -if (MSVC) - if (CMAKE_CL_64) - target_compile_definitions(libtiff PRIVATE -D_WIN64) - endif () -endif () - set_target_properties(libtiff PROPERTIES CXX_STANDARD 11) set_property(TARGET libtiff PROPERTY POSITION_INDEPENDENT_CODE ${GDAL_OBJECT_LIBRARIES_POSITION_INDEPENDENT_CODE}) target_sources(${GDAL_LIB_TARGET_NAME} PRIVATE $) diff --git a/gdal.cmake b/gdal.cmake index 1799ea709019..1841b9650396 100644 --- a/gdal.cmake +++ b/gdal.cmake @@ -454,9 +454,6 @@ target_include_directories( if (MSVC) target_sources(${GDAL_LIB_TARGET_NAME} PRIVATE gcore/Version.rc) source_group("Resource Files" FILES gcore/Version.rc) - if (CMAKE_CL_64) - set_target_properties(${GDAL_LIB_TARGET_NAME} PROPERTIES STATIC_LIBRARY_FLAGS "/machine:x64") - endif () endif () get_property(_plugins GLOBAL PROPERTY PLUGIN_MODULES) diff --git a/port/CMakeLists.txt b/port/CMakeLists.txt index 08a3bfda6730..c77e5c6b8df8 100644 --- a/port/CMakeLists.txt +++ b/port/CMakeLists.txt @@ -244,11 +244,7 @@ if (GDAL_USE_ODBC) endif () endif () -if (MSVC) - if (CMAKE_CL_64) - target_compile_definitions(cpl PRIVATE -D_WIN64) - endif () -else () +if (NOT MSVC) if (Threads_FOUND) gdal_target_link_libraries(cpl PRIVATE Threads::Threads) endif () From 0a5148cc1040baaa0c107bc49f0c3ebeeb7cc8b7 Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Wed, 20 Nov 2024 21:53:44 +0100 Subject: [PATCH 2/2] Remove obsolete FindDB2.cmake --- cmake/modules/packages/FindDB2.cmake | 103 --------------------------- 1 file changed, 103 deletions(-) delete mode 100644 cmake/modules/packages/FindDB2.cmake diff --git a/cmake/modules/packages/FindDB2.cmake b/cmake/modules/packages/FindDB2.cmake deleted file mode 100644 index a18b7777279e..000000000000 --- a/cmake/modules/packages/FindDB2.cmake +++ /dev/null @@ -1,103 +0,0 @@ -############################################################################### -# CMake module to search for DB2 client library -# -# On success, the macro sets the following variables: -# DB2_FOUND = if the library found -# DB2_LIBRARY = full path to the library -# DB2_LIBRARIES = full path to the library -# DB2_INCLUDE_DIR = where to find the library headers -# -# Copyright (c) 2013 Denis Chapligin -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. -# -############################################################################### - -if(UNIX) - set(DB2_INSTALL_PATHS - /opt/ibm/db2/V10.1 - /opt/ibm/db2/V9.7 - /opt/ibm/db2/V9.5 - /opt/ibm/db2/V9.1 - /opt/ibm/clidriver - /opt/clidriver) - - if(CMAKE_SIZEOF_VOID_P EQUAL 4) - set(DB2_LIBDIRS "lib32" "lib") - else() - set(DB2_LIBDIRS "lib64" "lib") - endif() - - set(DB2_FIND_INCLUDE_PATHS) - set(DB2_FIND_LIB_PATHS) - foreach(db2_install_path ${DB2_INSTALL_PATHS}) - if (IS_DIRECTORY ${db2_install_path}/include) - set(DB2_FIND_INCLUDE_PATHS - ${DB2_FIND_INCLUDE_PATHS} - ${db2_install_path}/include) - endif() - foreach(db2_libdir ${DB2_LIBDIRS}) - if (IS_DIRECTORY ${db2_install_path}/${db2_libdir}) - set(DB2_FIND_LIB_PATHS - ${DB2_FIND_LIB_PATHS} - ${db2_install_path}/${db2_libdir}) - endif() - endforeach(db2_libdir) - endforeach(db2_install_path) -elseif(WIN32) - if (CMAKE_SIZEOF_VOID_P EQUAL "8") # 64-bit build, DB2 64-bit installed - set(DB2_FIND_INCLUDE_PATHS $ENV{ProgramW6432}/IBM/SQLLIB/include) - set(DB2_FIND_LIB_PATHS $ENV{ProgramW6432}/IBM/SQLLIB/lib) - else() # 32-bit build, DB2 64-bit or DB2 32-bit installed - - if(EXISTS "$ENV{ProgramW6432}/IBM/SQLLIB/lib") - # On 64-bit Windows with DB2 64-bit installed: - # LIB environment points to {DB2}/IBM/SQLLIB/lib with64-bit db2api.lib, - # this flag prevents checking paths in LIB, so Win32 version can be detected - set(DB2_FIND_LIB_NO_LIB NO_SYSTEM_ENVIRONMENT_PATH) - - endif() - - set(DB2_FIND_INCLUDE_PATHS - $ENV{ProgramW6432}/IBM/SQLLIB/include - $ENV{ProgramFiles}/IBM/SQLLIB/include) - set(DB2_FIND_LIB_PATHS - $ENV{ProgramFiles}/IBM/SQLLIB/lib - $ENV{ProgramFiles}/IBM/SQLLIB/lib/win32 - $ENV{ProgramW6432}/IBM/SQLLIB/lib/win32) - endif() -endif() - -find_path(DB2_INCLUDE_DIR sqlcli1.h - $ENV{DB2_INCLUDE_DIR} - $ENV{DB2_DIR}/include - $ENV{DB2_HOME} - $ENV{IBM_DB_INCLUDE} - ${DB2_FIND_INCLUDE_PATHS}) - -find_library(DB2_LIBRARY - NAMES db2 db2api - PATHS - $ENV{DB2LIB} - $ENV{IBM_DB_LIB} - ${DB2_FIND_LIB_PATHS} - ${DB2_FIND_LIB_NO_LIB}) - -if(DB2_LIBRARY) - get_filename_component(DB2_LIBRARY_DIR ${DB2_LIBRARY} PATH) -endif() - -if(DB2_INCLUDE_DIR AND DB2_LIBRARY_DIR) - set(DB2_FOUND TRUE) -endif() - -set(DB2_LIBRARIES ${DB2_LIBRARY}) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(DB2 - DEFAULT_MSG - DB2_INCLUDE_DIR - DB2_LIBRARIES) - -mark_as_advanced(DB2_INCLUDE_DIR DB2_LIBRARIES)