Check if PIE is supported on MSVC too in the CMakeLists.txt file.

This commit is contained in:
Username404 2021-03-27 11:10:08 +01:00
parent 11ea331d89
commit b21c2ae643
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 10 additions and 7 deletions

View File

@ -20,15 +20,18 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
set(CMAKE_CXX_FLAGS "-Wall")
if (NOT MSVC)
if (CMAKE_POSITION_INDEPENDENT_CODE)
include(CheckPIESupported)
if (CMAKE_POSITION_INDEPENDENT_CODE)
include(CheckPIESupported)
if (NOT MSVC)
add_link_options("-pie")
check_pie_supported()
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
endif ()
check_pie_supported()
endif()
if (NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
set(CMAKE_CXX_FLAGS_RELEASE "-Os")
endif()
set(CMAKE_CXX_FLAGS_RELEASE "-Os")
if ((${CMAKE_CXX_COMPILER_ID} STREQUAL GNU) OR (${CMAKE_CXX_COMPILER_ID} STREQUAL Clang))
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11.0)