Improved CMake structure.
This commit is contained in:
parent
9c9995380e
commit
88cb8f4516
@ -16,6 +16,14 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
|
||||
if (CMAKE_GENERATOR STREQUAL "Ninja" AND
|
||||
((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9) OR
|
||||
(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5)))
|
||||
# Force colored warnings in Ninja's output, if the compiler has -fdiagnostics-color support.
|
||||
# Rationale in https://github.com/ninja-build/ninja/issues/814
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=always")
|
||||
endif()
|
||||
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(app)
|
||||
if(PLASP_BUILD_TESTS)
|
||||
|
@ -3,7 +3,7 @@ set(target plasp-app)
|
||||
file(GLOB core_sources "*.cpp")
|
||||
file(GLOB core_headers "*.h")
|
||||
|
||||
include_directories(
|
||||
set(includes
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${PROJECT_SOURCE_DIR}/include
|
||||
)
|
||||
@ -19,5 +19,6 @@ set(libraries
|
||||
)
|
||||
|
||||
add_executable(${target} ${sources})
|
||||
target_include_directories(${target} PRIVATE ${includes})
|
||||
target_link_libraries(${target} ${libraries})
|
||||
set_target_properties(${target} PROPERTIES OUTPUT_NAME plasp)
|
||||
|
@ -21,11 +21,11 @@ file(GLOB input_headers "../include/plasp/input/*.h")
|
||||
file(GLOB output_sources "plasp/output/*.cpp")
|
||||
file(GLOB output_headers "../include/plasp/output/*.h")
|
||||
|
||||
include_directories(
|
||||
${Boost_INCLUDE_DIRS}
|
||||
)
|
||||
file(GLOB utils_sources "plasp/utils/*.cpp")
|
||||
file(GLOB utils_headers "../include/plasp/utils/*.h")
|
||||
|
||||
include_directories(
|
||||
set(includes
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${PROJECT_SOURCE_DIR}/include
|
||||
)
|
||||
|
||||
@ -50,6 +50,9 @@ set(sources
|
||||
|
||||
${output_sources}
|
||||
${output_headers}
|
||||
|
||||
${utils_sources}
|
||||
${utils_headers}
|
||||
)
|
||||
|
||||
set(libraries
|
||||
@ -58,4 +61,5 @@ set(libraries
|
||||
)
|
||||
|
||||
add_library(${target} ${sources})
|
||||
target_include_directories(${target} PRIVATE ${includes})
|
||||
target_link_libraries(${target} ${libraries})
|
||||
|
@ -2,7 +2,7 @@ set(target tests)
|
||||
|
||||
file(GLOB core_sources "*.cpp")
|
||||
|
||||
include_directories(
|
||||
set(includes
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${PROJECT_SOURCE_DIR}/include
|
||||
${PROJECT_SOURCE_DIR}/lib/catch/single_include
|
||||
@ -14,6 +14,7 @@ set(libraries
|
||||
)
|
||||
|
||||
add_executable(${target} ${core_sources})
|
||||
target_include_directories(${target} PRIVATE ${includes})
|
||||
target_link_libraries(${target} ${libraries})
|
||||
|
||||
add_custom_target(run-tests
|
||||
|
Reference in New Issue
Block a user