Skip to content

Commit 15a1ffc

Browse files
committed
cmake: use compiler detection instead of “MSVC” and “NOT MSVC AND WIN32”
1 parent fdc55a5 commit 15a1ffc

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,9 @@ if (USE_EXTERNAL_DEPS AND NOT DAEMON_TARGET_SYSTEM_NaCl)
206206

207207
set(DEPS_ARCH "${DAEMON_ARCH}")
208208

209-
if (MSVC)
209+
if (DAEMON_CXX_COMPILER_MSVC)
210210
set(DEPS_COMPILER msvc)
211-
elseif (WIN32)
211+
elseif (DAEMON_CXX_COMPILER_MinGW)
212212
set(DEPS_COMPILER mingw)
213213
else()
214214
set(DEPS_COMPILER default)
@@ -834,9 +834,9 @@ macro(AddApplicationInternal Target Executable)
834834
# Append Windows specific manifests.
835835
# Adding the .manifest as a source works better for MSVC, but it has no
836836
# effect for MinGW (https://gitlab.kitware.com/cmake/cmake/-/issues/23244).
837-
if (MINGW)
837+
if (DAEMON_CXX_COMPILER_MinGW)
838838
target_sources(${Target} PRIVATE ${ENGINE_DIR}/sys/windows-resource/manifest.rc)
839-
elseif (WIN32)
839+
elseif (DAEMON_CXX_COMPILER_MSVC)
840840
target_sources(${Target} PRIVATE ${ENGINE_DIR}/sys/windows-resource/supported-os.manifest)
841841
endif()
842842

cmake/DaemonFlags.cmake

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ mark_as_advanced(USE_RECOMMENDED_CXX_STANDARD)
5555

5656
option(USE_CPP23 "Use C++23 standard where possible" OFF)
5757

58-
if (MSVC)
58+
if (DAEMON_CXX_COMPILER_MSVC)
5959
set(DEFAULT_STRIP_SOURCE_PATHS ON)
6060
else()
6161
set(DEFAULT_STRIP_SOURCE_PATHS OFF)
@@ -153,7 +153,7 @@ function(try_flag LIST FLAG)
153153
# Other compilers might interpret it as a filename so reject without testing.
154154
string(SUBSTRING "${FLAG}" 0 1 FLAG_FIRST_CHAR)
155155
if ("${FLAG_FIRST_CHAR}" STREQUAL "/")
156-
if (MSVC)
156+
if (DAEMON_CXX_COMPILER_MSVC)
157157
set(${TEST} 1)
158158
else()
159159
set(${TEST} 0)
@@ -233,7 +233,7 @@ if (STRIP_SOURCE_PATHS)
233233
set(FILENAME_STRIP_DIRS ${FILENAME_STRIP_DIRS} "${DAEMON_DIR}/src" "${DAEMON_DIR}")
234234
endif()
235235
foreach(strip_dir ${FILENAME_STRIP_DIRS})
236-
if (MSVC)
236+
if (DAEMON_CXX_COMPILER_MSVC)
237237
string(REPLACE "/" "\\" backslashed_dir ${strip_dir})
238238
# set_c_cxx_flag can't be used because macros barf if the input contains backslashes
239239
# https://gitlab.kitware.com/cmake/cmake/-/issues/19281
@@ -259,7 +259,7 @@ if (USE_FLOAT_EXCEPTIONS)
259259
add_definitions(-DDAEMON_USE_FLOAT_EXCEPTIONS)
260260
endif()
261261

262-
if (MSVC)
262+
if (DAEMON_CXX_COMPILER_MSVC)
263263
set_c_cxx_flag("/MP")
264264

265265
# There is no flag for standards before C++17
@@ -577,7 +577,7 @@ endif()
577577
option(USE_CPU_RECOMMENDED_FEATURES "Use some common hardware features like SSE2, NEON, VFP, MCX16, etc." ON)
578578

579579
# Target options.
580-
if (MSVC)
580+
if (DAEMON_CXX_COMPILER_MSVC)
581581
if (DAEMON_ARCH_i686)
582582
if (USE_CPU_RECOMMENDED_FEATURES)
583583
set_c_cxx_flag("/arch:SSE2") # This is the default
@@ -682,7 +682,7 @@ if (DAEMON_TARGET_SYSTEM_Windows)
682682
set(CMAKE_FIND_LIBRARY_PREFIXES ${CMAKE_FIND_LIBRARY_PREFIXES} "" "lib")
683683
endif()
684684

685-
if (MSVC)
685+
if (DAEMON_CXX_COMPILER_MSVC)
686686
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
687687
endif()
688688

0 commit comments

Comments
 (0)