test-shared-lib/CMakeLists.txt

25 lines
931 B
CMake
Raw Normal View History

2020-05-16 23:32:17 +02:00
cmake_minimum_required(VERSION 3.9)
2020-05-16 23:42:11 +02:00
project(test_shared_library LANGUAGES C VERSION 1.0.2 DESCRIPTION "Shared C Library for testing of various cmake configurations")
2020-05-16 23:32:17 +02:00
include(GNUInstallDirs)
add_library(test_shared_library SHARED test_shared_library.c test_shared_library.h)
set(CMAKE_C_STANDARD 99)
set_target_properties(test_shared_library PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION 1
PUBLIC_HEADER test_shared_library.h)
configure_file(test_shared_library.pc.in test_shared_library.pc @ONLY)
target_include_directories(test_shared_library PRIVATE .)
install(TARGETS test_shared_library
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(FILES ${CMAKE_BINARY_DIR}/test_shared_library.pc
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig)
add_executable(test test.c)
2020-05-16 23:42:11 +02:00
target_link_libraries(test test_shared_library)