diff --git a/CMakeLists.txt b/CMakeLists.txt index 48a38d9..64f7e74 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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)