CMake-config Fixes
autotools: CMake config handles now linking against the static library correctly
CMake: CMake config populates now the include directly correctly
MODIFY
.gitignore
.gitignore
/autom4te.cache/
/builds/autoconf/
!/builds/autoconf/m4/m4_ax_pkg_check_modules.m4
+!/builds/autoconf/liblcf-config.cmake.in
/lcf2xml
/liblcf-*/
.deps/

MODIFY
CMakeLists.txt
CMakeLists.txt
@@ -297,6 +297,8 @@ foreach(SG LDB LMT LMU LSD RPG THIRD_PARTY)
endforeach()
# includes
+include(GNUInstallDirs)
+
target_include_directories(
lcf PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/src>
@@ -367,7 +369,6 @@ target_sources(lcf PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src/lcf/config.h)
set_property(TARGET lcf PROPERTY SOVERSION 0)
# installation
-include(GNUInstallDirs)
# pkg-config file generation
set(LCF_LIBDIR ${CMAKE_INSTALL_LIBDIR})

MODIFY
builds/autoconf/liblcf-config.cmake.in
builds/autoconf/liblcf-config.cmake.in
-# For simplicity reasons depend on pkg-config when liblcf was compiled with autotools
+# For "simplicity" reasons depend on pkg-config when liblcf was compiled with autotools
include(CMakeFindDependencyMacro)
@@ -6,4 +6,14 @@ find_dependency(PkgConfig REQUIRED QUIET)
pkg_check_modules(liblcf REQUIRED QUIET IMPORTED_TARGET liblcf=@PACKAGE_VERSION@)
+get_property(library_name TARGET PkgConfig::liblcf PROPERTY INTERFACE_LINK_LIBRARIES)
+
+if (library_name MATCHES ".a$")
+ list(REMOVE_ITEM liblcf_STATIC_LIBRARIES lcf)
+ set_property(TARGET PkgConfig::liblcf APPEND PROPERTY
+ INTERFACE_LINK_LIBRARIES "${liblcf_STATIC_LIBRARIES}")
+ set_property(TARGET PkgConfig::liblcf APPEND PROPERTY
+ INTERFACE_LINK_DIRECTORIES "${liblcf_STATIC_LIBRARY_DIRS}")
+endif()
+
add_library(liblcf::liblcf ALIAS PkgConfig::liblcf)

CMake-config Fixes

autotools: CMake config handles now linking against the static library correctly
CMake: CMake config populates now the include directly correctly