diff --git a/CMakeLists.txt b/CMakeLists.txt index 65a8a05..28cffa6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,9 +4,13 @@ project(mastodont DESCRIPTION "Library for Mastodon, Pleroma, Wormhole, etc." LANGUAGES C) +# BEGIN cmake package config info include(CMakePackageConfigHelpers) -set(INCLUDE_INSTALL_DIR include/) +set(INCLUDE_INSTALL_DIR include/mastodont/) set(LIB_INSTALL_DIR lib/) +# This feels... UNIX-y +set(LIB_INSTALL_PATH lib/libmastodont.a) +# END cmake package config info # Useful set(CMAKE_EXPORT_COMPILE_COMMANDS ON) @@ -86,7 +90,6 @@ list(APPEND SRC_FILES src/uri.c) add_library(mastodont STATIC ${HEADER_FILES}) - target_sources(mastodont PRIVATE ${SRC_FILES}) target_compile_options(mastodont PUBLIC @@ -111,11 +114,11 @@ if(CJSON_FOUND AND CJSON_VERSION VERSION_GREATER_EQUAL 1.7.14) LIBRARY DESTINATION lib) configure_package_config_file(cmake/MastodontConfig.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/MastodontConfig.cmake + ${CMAKE_CURRENT_BINARY_DIR}/mastodont-config.cmake INSTALL_DESTINATION lib/cmake/mastodont - PATH_VARS INCLUDE_INSTALL_DIR LIB_INSTALL_DIR) + PATH_VARS INCLUDE_INSTALL_DIR LIB_INSTALL_DIR LIB_INSTALL_PATH) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/MastodontConfig.cmake DESTINATION lib/cmake/mastodont) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/mastodont-config.cmake DESTINATION lib/cmake/mastodont) else() message("Since CJSON wasn't found or your distribution doesn't provide correct version, you can still use cmake/mastodont-config.cmake and check for it in your package. You _probably_ don't want this") endif() diff --git a/cmake/MastodontConfig.cmake.in b/cmake/MastodontConfig.cmake.in index d557a75..c249d02 100644 --- a/cmake/MastodontConfig.cmake.in +++ b/cmake/MastodontConfig.cmake.in @@ -2,8 +2,9 @@ set(MASTODONT_VERSION 0.0.1) @PACKAGE_INIT@ -set_and_check(MASTODONT_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@") -set_and_check(MASTODONT_LIB "@PACKAGE_LIB_INSTALL_DIR@") +set_and_check(MASTODONT_INCLUDE_DIRS "@PACKAGE_INCLUDE_INSTALL_DIR@") +set_and_check(MASTODONT_LIB_DIR "@PACKAGE_LIB_INSTALL_DIR@") +set_and_check(MASTODONT_LIBRARIES "@PACKAGE_LIB_INSTALL_PATH@") #set_and_check(MASTODONT_SYSCONFIG_DIR "@PACKAGE_SYSCONFIG_INSTALL_DIR@") check_required_components(mastodont)