diff --git a/CMakeLists.txt b/CMakeLists.txt index 5ec4c35..c222294 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,11 +1,22 @@ -cmake_minimum_required (VERSION 3.10) +cmake_minimum_required(VERSION 3.10) project(platform) -file(GLOB platform_headers ./src/platform/*.hpp) - +# Define library add_library(platform INTERFACE) +target_compile_features(platform INTERFACE cxx_std_14) +target_include_directories(platform INTERFACE src/) add_library(steinwurf::platform ALIAS platform) -target_include_directories(platform INTERFACE src/) +# Install headers +install( + DIRECTORY ./src/platform + DESTINATION ${CMAKE_INSTALL_PREFIX}/include + FILES_MATCHING + PATTERN *.hpp) -install(FILES ${platform_headers} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/platform) +# Is top level project? +if(${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME}) + # Build executables + add_executable(print_platform examples/print_platform/main.cpp) + target_link_libraries(print_platform platform) +endif() diff --git a/NEWS.rst b/NEWS.rst index 373b0e1..a48ffba 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -6,7 +6,7 @@ every change, see the Git log. Latest ------ -* tbd +* Major: Change cmake build to be object library based. 3.5.0 -----