Skip to content

Commit

Permalink
CMAKE_BUILD_TYPEが設定されていなければDebugにする
Browse files Browse the repository at this point in the history
  • Loading branch information
Nishizaki committed Oct 28, 2022
1 parent 35e2ee7 commit 73a2256
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions c_cmake_ninja/CMakeLists.txt
Expand Up @@ -18,9 +18,13 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there. You may need to remove CMakeCache.txt. ")
endif()

SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
set(default_build_type "Debug")
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Debug")
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release")
endif()

set(CMAKE_C_FLAGS "-Wall -Wextra")
Expand Down
1 change: 1 addition & 0 deletions c_cmake_ninja/config_release.bat
@@ -0,0 +1 @@
call config.bat -DCMAKE_BUILD_TYPE=Release

0 comments on commit 73a2256

Please sign in to comment.