Skip to content

Commit

Permalink
improve build settings 2
Browse files Browse the repository at this point in the history
  • Loading branch information
katahiromz committed May 28, 2023
1 parent a1f64df commit fa1a212
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,24 @@ if (NOT uppercase_CMAKE_BUILD_TYPE MATCHES "^(DEBUG|RELEASE|RELWITHDEBINFO|MINSI
message(FATAL_ERROR "Invalid value for CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
endif()

if ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"))
# using Clang or GCC
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# using Clang
if (uppercase_CMAKE_BUILD_TYPE MATCHES "^RELEASE$")
set(CMAKE_C_FLAGS "-static -O3 -Wall -pedantic")
set(CMAKE_CXX_FLAGS "-static -O3 -Wall -pedantic")
else()
set(CMAKE_C_FLAGS "-static -g -Wall -pedantic")
set(CMAKE_CXX_FLAGS "-static -g -Wall -pedantic")
endif()
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# using GCC
if (uppercase_CMAKE_BUILD_TYPE MATCHES "^RELEASE$")
set(CMAKE_C_FLAGS "-s -static -O3 -Wall -pedantic")
set(CMAKE_CXX_FLAGS "-s -static -O3 -Wall -pedantic")
else()
set(CMAKE_C_FLAGS "-static -g -Wall -pedantic")
set(CMAKE_CXX_FLAGS "-static -g -Wall -pedantic")
endif()
elseif (MSVC AND NOT uppercase_CMAKE_BUILD_TYPE MATCHES "^DEBUG$")
# replace "/MD" with "/MT" (building without runtime DLLs)
set(CompilerFlags
Expand Down

0 comments on commit fa1a212

Please sign in to comment.