Merge pull request #319 from jktjkt/cmake

cmake: misc improvements
This commit is contained in:
Gabi Melman 2016-11-22 13:39:32 +02:00 committed by GitHub
commit b2ce64625d

View File

@ -5,14 +5,18 @@
cmake_minimum_required(VERSION 3.1) cmake_minimum_required(VERSION 3.1)
project(spdlog VERSION 1.0.0) project(spdlog VERSION 1.0.0)
include(CTest)
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set(CMAKE_CXX_FLAGS "-Wall ${CMAKE_CXX_FLAGS}")
endif()
add_library(spdlog INTERFACE) add_library(spdlog INTERFACE)
option(SPDLOG_BUILD_EXAMPLES "Build examples" OFF) option(SPDLOG_BUILD_EXAMPLES "Build examples" OFF)
option(SPDLOG_BUILD_TESTS "Build tests" OFF)
target_include_directories( target_include_directories(
spdlog spdlog
@ -28,7 +32,7 @@ if(SPDLOG_BUILD_EXAMPLES)
add_subdirectory(example) add_subdirectory(example)
endif() endif()
if(SPDLOG_BUILD_TESTS) if(BUILD_TESTING)
add_subdirectory(tests) add_subdirectory(tests)
endif() endif()
@ -78,3 +82,6 @@ install(
NAMESPACE "${namespace}" NAMESPACE "${namespace}"
DESTINATION "${config_install_dir}" DESTINATION "${config_install_dir}"
) )
file(GLOB_RECURSE spdlog_include_SRCS "${HEADER_BASE}/*.h")
add_custom_target(spdlog_headers_for_ide SOURCES ${spdlog_include_SRCS})