mariadb/win/upgrade_wizard/CMakeLists.txt
Vladislav Vaintroub b005b6097f Cleanup CMake code (Windows-specific)
Prepare for a more modern CMake version than the current minimum.

- Use CMAKE_MSVC_RUNTIME_LIBRARY instead of the custom MSVC_CRT_TYPE.
- Replace CMAKE_{C,CXX}_FLAGS modifications with
  add_compile_definitions/options and add_link_options.
  The older method already broke with new pcre2.
- Fix clang-cl compilation and ASAN build.
- Avoid modifying CMAKE_C_STANDARD_LIBRARIES/CMAKE_CXX_STANDARD_LIBRARIES,
  as this is discouraged by CMake.
- Reduce system checks.
2025-04-04 08:58:40 +02:00

37 lines
1,013 B
CMake

IF((NOT MSVC) OR CLANG_CL OR WITH_ASAN)
RETURN()
ENDIF()
# We need MFC
# /permissive- flag does not play well with MFC, disable it.
REMOVE_DEFINITIONS(-DNOSERVICE) # fixes "already defined" warning in an AFX header
FIND_PACKAGE(MFC)
IF(NOT MFC_FOUND)
IF(BUILD_RELEASE)
MESSAGE(FATAL_ERROR
"Can't find MFC. It is necessary for producing official package"
)
ENDIF()
RETURN()
ENDIF()
# MFC should be statically linked
SET(CMAKE_MFC_FLAG 1)
# Enable exception handling (avoids warnings)
ADD_DEFINITIONS(-DNO_WARN_MBCS_MFC_DEPRECATION)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/sql)
MYSQL_ADD_EXECUTABLE(mariadb-upgrade-wizard
upgrade.cpp upgradeDlg.cpp
${CMAKE_SOURCE_DIR}/sql/winservice.c
upgrade.rc
COMPONENT Server)
# upgrade_wizard is Windows executable, set WIN32_EXECUTABLE so it does not
# create a console.
SET_TARGET_PROPERTIES(mariadb-upgrade-wizard PROPERTIES
WIN32_EXECUTABLE 1
LINK_FLAGS "/MANIFESTUAC:level='requireAdministrator'"
MSVC_RUNTIME_LIBRARY MultiThreaded
)