Skip to content

Amend #448. CMake: INSTALL_INTERFACE must be CMAKE_INSTALL_INCLUDEDIR #449

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 11, 2023

Conversation

Ghabry
Copy link
Member

@Ghabry Ghabry commented Jan 11, 2023

Verified this now by looking in build.ninja

Player build tested on a Linux with liblcf uninstalled and on macOS.

@Ghabry Ghabry added this to the 0.7.1 milestone Jan 11, 2023
@Ghabry Ghabry merged commit 8ef4298 into EasyRPG:master Jan 11, 2023
@Ghabry
Copy link
Member Author

Ghabry commented Jan 11, 2023

Fails when liblcf is static...

Workaround: Do export PKG_CONFIG="pkg-config --static" before running CMake (thanks c1).


To automatically handle this for liblcf.a you likely need dumb shit like (based on our FindSDL2.cmake):

Yes there is no API to detect if it is a static library. Will just keep this here for a few days until I consider the next step :D.

diff --git a/builds/autoconf/liblcf-config.cmake.in b/builds/autoconf/liblcf-config.cmake.in
index 557cee8..a76c2bf 100644
--- a/builds/autoconf/liblcf-config.cmake.in
+++ b/builds/autoconf/liblcf-config.cmake.in
@@ -1,4 +1,4 @@
-# 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)

@carstene1ns
Copy link
Member

INTERFACE_INCLUDE_DIRECTORIES "${liblcf_STATIC_LIBRARY_DIRS}")

This looks wrong.

@Ghabry
Copy link
Member Author

Ghabry commented Jan 11, 2023

I took this from our FindSDL2.cmake lol.

You are right. It is INTERFACE_LINK_DIRECTORIES. I updated the diff with a working version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

3 participants