Skip to content
This repository was archived by the owner on Oct 7, 2024. It is now read-only.

Commit 11c4b8d

Browse files
mimi89999dlech
authored andcommitted
Use MSVC compiler flags only with MSVC
1 parent bda03a4 commit 11c4b8d

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

CMakeLists.txt

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,18 @@ set(CMAKE_CXX_STANDARD 20)
1313
set(CMAKE_CXX_STANDARD_REQUIRED ON)
1414
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
1515

16-
# TODO: re-enable /GL and /LTCG when we get a bigger build machine
17-
add_compile_options(/bigobj /GR- /permissive-)
16+
if (MSVC)
17+
# TODO: re-enable /GL and /LTCG when we get a bigger build machine
18+
add_compile_options(/bigobj /GR- /permissive-)
19+
20+
string(REGEX REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
21+
# TODO: re-enable /GL and /LTCG when we get a bigger build machine
22+
# string(APPEND CMAKE_MODULE_LINKER_FLAGS " /LTCG:STATUS")
23+
24+
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "19.20.27404.0")
25+
string(APPEND CMAKE_CXX_FLAGS " /d2FH4")
26+
endif()
27+
endif()
1828

1929
# strip suffix to allow support for prerelease version
2030
string(REGEX MATCH "^[0-9]\\.[0-9]+(\\.[0-9]+)?" PYTHON_BASE_VERSION ${PYTHON_VERSION_STRING})
@@ -34,12 +44,4 @@ if($ENV{CI})
3444
set_property(TARGET _winrt PROPERTY JOB_POOL_COMPILE compile_job)
3545
endif()
3646

37-
string(REGEX REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
38-
# TODO: re-enable /GL and /LTCG when we get a bigger build machine
39-
# string(APPEND CMAKE_MODULE_LINKER_FLAGS " /LTCG:STATUS")
40-
41-
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "19.20.27404.0")
42-
string(APPEND CMAKE_CXX_FLAGS " /d2FH4")
43-
endif()
44-
4547
install(TARGETS _winrt DESTINATION "pywinrt/${CMAKE_PROJECT_NAME}")

0 commit comments

Comments
 (0)