Merge pull request #124 from DasRoteSkelett/bugfix/locationCmakeConfigFilesOnInstall

CMakeLists.txt: Minimal fixes, added GNUInstallDirs and fixed cmake c…
This commit is contained in:
Krzysztof Gabis 2019-11-28 10:06:26 +01:00 committed by GitHub
commit de7fbfac12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,24 +1,29 @@
cmake_minimum_required(VERSION 3.5)
project(parson C)
include (GNUInstallDirs)
set(PARSON_VERSION 1.0.0)
add_library(parson parson.c)
target_include_directories(parson PUBLIC $<INSTALL_INTERFACE:include>)
set_target_properties(parson PROPERTIES PUBLIC_HEADER "parson.h")
set_target_properties(parson PROPERTIES VERSION ${PARSON_VERSION})
set_target_properties(parson PROPERTIES SOVERSION ${PARSON_VERSION})
install(
TARGETS parson
EXPORT parsonTargets
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
PUBLIC_HEADER DESTINATION include
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT shlib
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
install(
EXPORT parsonTargets
FILE parsonConfig.cmake
NAMESPACE parson::
DESTINATION cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
)