Просмотр исходного кода

Build: `add_definitions()` → `add_compile_definitions()`

Alex Turbov 3 лет назад
Родитель
Сommit
83491ddd43
4 измененных файлов с 6 добавлено и 6 удалено
  1. 1 1
      CMakeLists.txt
  2. 2 2
      CompileFlags.cmake
  3. 2 2
      Source/CMakeLists.txt
  4. 1 1
      Source/QtDialog/CMakeLists.txt

+ 1 - 1
CMakeLists.txt

@@ -595,7 +595,7 @@ macro(CMAKE_BUILD_UTILITIES)
     set(EXPAT_LIBRARY ${CMAKE_EXPAT_LIBRARIES})
     set(ZLIB_INCLUDE_DIR ${CMAKE_ZLIB_INCLUDES})
     set(ZLIB_LIBRARY ${CMAKE_ZLIB_LIBRARIES})
-    add_definitions(-DLIBARCHIVE_STATIC)
+    add_compile_definitions(LIBARCHIVE_STATIC)
     set(ENABLE_MBEDTLS OFF)
     set(ENABLE_NETTLE OFF)
     if(DEFINED CMAKE_USE_OPENSSL)

+ 2 - 2
CompileFlags.cmake

@@ -18,7 +18,7 @@ endif()
 # not hurt other versions, and this will work into the
 # future
 if(MSVC OR _INTEL_WINDOWS OR _CLANG_MSVC_WINDOWS)
-  add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
+  add_compile_definitions(_CRT_SECURE_NO_DEPRECATE _CRT_NONSTDC_NO_DEPRECATE)
 else()
 endif()
 
@@ -62,7 +62,7 @@ endif()
 # Use 64-bit off_t on 32-bit Linux
 if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SIZEOF_VOID_P EQUAL 4)
   # ensure 64bit offsets are used for filesystem accesses for 32bit compilation
-  add_definitions(-D_FILE_OFFSET_BITS=64)
+  add_compile_definitions(_FILE_OFFSET_BITS=64)
 endif()
 
 # Workaround for TOC Overflow on ppc64

+ 2 - 2
Source/CMakeLists.txt

@@ -48,10 +48,10 @@ set(EXECUTABLE_OUTPUT_PATH ${CMake_BIN_DIR})
 
 if(WIN32)
   # ensure Unicode friendly APIs are used on Windows
-  add_definitions(-DUNICODE -D_UNICODE)
+  add_compile_definitions(UNICODE _UNICODE)
 
   # minimize windows.h content
-  add_definitions(-DWIN32_LEAN_AND_MEAN)
+  add_compile_definitions(WIN32_LEAN_AND_MEAN)
 endif()
 
 # configure the .dox.in file

+ 1 - 1
Source/QtDialog/CMakeLists.txt

@@ -42,7 +42,7 @@ set(CMake_QT_EXTRA_LIBRARIES)
 if(WIN32)
   find_package(Qt${INSTALLED_QT_VERSION}WinExtras QUIET)
   if(Qt${INSTALLED_QT_VERSION}WinExtras_FOUND)
-    add_definitions(-DQT_WINEXTRAS)
+    add_compile_definitions(QT_WINEXTRAS)
     list(APPEND CMake_QT_EXTRA_LIBRARIES Qt${INSTALLED_QT_VERSION}::WinExtras)
     list(APPEND QT_COMPONENTS WinExtras)
   endif()