diff options
author | FormerLurker <hochgebe@gmail.com> | 2021-01-18 21:35:20 +0300 |
---|---|---|
committer | FormerLurker <hochgebe@gmail.com> | 2021-01-18 21:35:20 +0300 |
commit | 3af9af2cdc778bbb7f481177cf3c840e6d9d1ee2 (patch) | |
tree | 1a1e4648c5d7a9321d7766ea265aceabe16a8198 /CMakeLists.txt | |
parent | b35d6aa16d9dae8350a36ac0256bf68a1ac51cef (diff) |
Simplify cmake
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 4c4bce6..0d4303c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,10 @@ -cmake_minimum_required (VERSION "3.13") +cmake_minimum_required (VERSION "3.15") set(CMAKE_VERBOSE_MAKEFILE ON) -# You can tweak some common (for all subprojects) stuff here. For example: +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release) +endif() + project(Build C CXX) # Use and require C++ 11 @@ -13,18 +16,19 @@ set(CMAKE_DISABLE_SOURCE_CHANGES ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON) option(USE_CXX_EXCEPTIONS "Enable C++ exception support" ON) -# Add -O0 to remove optimizations when using gcc -IF(CMAKE_COMPILER_IS_GNUCC) - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0") - set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0") -ENDIF(CMAKE_COMPILER_IS_GNUCC) - - if(MSVC) + add_compile_options("$<$<CONFIG:RELEASE>:/O2>") # link to the msvc runtime statically, keeping debug info if we are in debug config set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") +else() + add_compile_options("$<$<CONFIG:RELEASE>:-O2>") + #if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + # add_compile_options("-stdlib=libc++") + #else() + #endif() endif() + # add a definition so our libraries know that the version info is available add_definitions("-DHAS_GENERATED_VERSION") # include the generated header. @@ -52,7 +56,6 @@ add_subdirectory(${CMAKE_SOURCE_DIR}/TCLAP) add_subdirectory(${CMAKE_SOURCE_DIR}/GcodeProcessorLib) add_subdirectory(${CMAKE_SOURCE_DIR}/ArcWelder) add_subdirectory(${CMAKE_SOURCE_DIR}/ArcWelderConsole) -#include(${CMAKE_CURRENT_SOURCE_DIR}/ArcWelderConsole/CMakeLists.txt) add_subdirectory(${CMAKE_SOURCE_DIR}/ArcWelderInverseProcessor) add_subdirectory(${CMAKE_SOURCE_DIR}/PyArcWelder) |