libfort/tests/add_subdirectory_tests/CMakeLists.txt

45 lines
969 B
CMake
Raw Permalink Normal View History

2020-02-23 07:09:32 +01:00
cmake_minimum_required(VERSION 3.0)
project(foo)
2020-02-23 07:19:51 +01:00
set(FORT_ENABLE_TESTING OFF CACHE INTERNAL "")
2020-02-23 07:09:32 +01:00
add_subdirectory(libfort)
# Create target that depend on libfort and check they'll compile ok
add_executable(foo-app
foo-app.cpp)
target_link_libraries(foo-app
PRIVATE fort
)
add_library(foo-lib
foo-lib.cpp)
target_link_libraries(foo-lib
2020-02-24 13:11:45 +01:00
PRIVATE libfort::fort)
2020-02-23 07:09:32 +01:00
add_library(foo-lib-shared SHARED
foo-lib.cpp)
target_link_libraries(foo-lib-shared
2020-02-24 13:11:45 +01:00
PRIVATE libfort::fort)
2020-02-23 07:09:32 +01:00
include(GNUInstallDirs)
install(
TARGETS foo-lib foo-lib-shared
EXPORT ${PROJECT_NAME}-targets
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
include(CMakePackageConfigHelpers)
install(
EXPORT ${PROJECT_NAME}-targets
FILE ${PROJECT_NAME}-targets.cmake
NAMESPACE ${PROJECT_NAME}::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
)