X-Git-Url: https://git.sthu.org/?a=blobdiff_plain;f=CMakeLists.txt;h=ad43d56860d47088c7743039cbebbfb168a0d870;hb=887a578cf248bc847125debe72549913067b73ba;hp=b5116d9d93515228cef3292c1dec55f45db5b5fe;hpb=267194caeb2fe56530b11c440fefd01c344e5482;p=libstick.git diff --git a/CMakeLists.txt b/CMakeLists.txt index b5116d9..ad43d56 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,16 @@ cmake_minimum_required (VERSION 2.6) project (libstick) +# Set a default build type if none was specified +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to 'Release' as none was specified.") + set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE) + # Set the possible values of build type for cmake-gui + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release") +endif() if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -ansi -pedantic") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -std=c++98 -pedantic") # I would like to use -pedantic, but VTK devs are not sufficiently # pedantic set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Werror") @@ -14,10 +21,10 @@ set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG") if(CMAKE_BUILD_TYPE STREQUAL "Release") # CMAKE_CXX_FLAGS_RELEASE is appended, but we need to prepend -O2 to take # effect - set(CMAKE_CXX_FLAGS "-O2 ${CMAKE_CXX_FLAGS}") + set(CMAKE_CXX_FLAGS "-O2 -g ${CMAKE_CXX_FLAGS}") endif() -set(PACKAGE_STRING stick) +set(PACKAGE_STRING libstick) set(PACKAGE_BUGREPORT stefan.huber@ist.ac.at) set(PACKAGE_VERSION 0.1) @@ -25,10 +32,11 @@ option(WITH_UNITTESTS "Enable unit tests" "OFF") add_subdirectory(include) add_subdirectory(lib) -add_subdirectory(src) if(WITH_UNITTESTS) add_subdirectory(tests) + enable_testing() + add_test(NAME unittests COMMAND tests) endif()