summaryrefslogtreecommitdiff
path: root/core/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'core/CMakeLists.txt')
-rw-r--r--core/CMakeLists.txt19
1 files changed, 8 insertions, 11 deletions
diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt
index a8fa7af..c4751a5 100644
--- a/core/CMakeLists.txt
+++ b/core/CMakeLists.txt
@@ -177,17 +177,9 @@ function(add_executable_variant TARGET_NAME)
endif()
endif()
- # Platform specific dependencies for Utils/Dialog, not covered by conan
- if(APPLE)
- target_link_libraries(${TARGET_NAME} PUBLIC ${COCOA_LIBRARY})
- elseif(LINUX)
- target_link_libraries(${TARGET_NAME} PUBLIC ${GTK3_LIBRARIES})
- target_include_directories(${TARGET_NAME} PRIVATE ${GTK3_INCLUDE_DIRS})
- endif()
-
if(WIN32)
- # No console window when targeting windows
function(handle_gnu_style_compiler)
+ # No console window when targeting windows
# Supposedly the flag -mwindows would automatically make the executable use GUI subsystem
# But, when subsystem is set to GUI, linker will only search WinMain and wWinMain but not the standard main (it seems like)
# so creating GUI executable fails and the linker silently reverts to the default, CUI subsystem
@@ -196,6 +188,7 @@ function(add_executable_variant TARGET_NAME)
endfunction()
function(handle_msvc_style_compiler)
+ # No console window when targeting windows
target_link_options(${TARGET_NAME} PRIVATE /SUBSYSTEM:windows /ENTRY:mainCRTStartup)
endfunction()
@@ -203,15 +196,19 @@ function(add_executable_variant TARGET_NAME)
# GCC (MinGW)
handle_gnu_style_compiler()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
- if("x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
+ if(CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")
# MSVC-style argument clang (clang-cl.exe)
handle_msvc_style_compiler()
- else()
+ elseif(CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "GNU")
# GNU-style argument clang (clang.exe and clang++.exe)
handle_gnu_style_compiler()
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
handle_msvc_style_compiler()
+
+ # Use updated __cplusplus macro
+ # https://docs.microsoft.com/en-us/cpp/build/reference/zc-cplusplus
+ target_compile_options(${TARGET_NAME} PUBLIC /Zc:__cplusplus)
endif()
endif()