diff options
| author | ruki <[email protected]> | 2021-10-20 00:43:14 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-10-20 00:43:14 +0800 |
| commit | 6cc23f1211ea6f635393e9d6a02ef93857bca9ab (patch) | |
| tree | 1fbc64996aa6b37ac183c0577b675af4f95bdf30 /xmake/modules | |
| parent | 1c92df260a519c84b647a07da5f7a85b4d792ff1 (diff) | |
fix cmake importfiles for headeronly
Diffstat (limited to 'xmake/modules')
| -rw-r--r-- | xmake/modules/cli/amalgamate.lua | 4 | ||||
| -rw-r--r-- | xmake/modules/target/action/install/cmake_importfiles.lua | 14 |
2 files changed, 9 insertions, 9 deletions
diff --git a/xmake/modules/cli/amalgamate.lua b/xmake/modules/cli/amalgamate.lua index e495ae70b..a9835eda6 100644 --- a/xmake/modules/cli/amalgamate.lua +++ b/xmake/modules/cli/amalgamate.lua @@ -35,8 +35,8 @@ local options = -- generate code function _generate_amalgamate_code(target, opt) - -- only for library - if not target:is_library() then + -- only for library/binary + if not target:is_library() and not target:is_binary() then return end diff --git a/xmake/modules/target/action/install/cmake_importfiles.lua b/xmake/modules/target/action/install/cmake_importfiles.lua index ea53ab519..c566b4471 100644 --- a/xmake/modules/target/action/install/cmake_importfiles.lua +++ b/xmake/modules/target/action/install/cmake_importfiles.lua @@ -41,7 +41,7 @@ function _get_builtinvars(target, installdir) return {TARGETNAME = target:name(), PROJECTNAME = project.name() or target:name(), TARGETFILENAME = target:targetfile() and _get_libfile(target, installdir), - TARGETKIND = target:is_shared() and "SHARED" or "STATIC", + TARGETKIND = target:is_headeronly() and "interface" or (target:is_shared() and "SHARED" or "STATIC"), PACKAGE_VERSION = target:get("version") or "1.0.0", TARGET_PTRBYTES = target:is_arch("x86", "i386") and "4" or "8"} end @@ -151,12 +151,12 @@ function main(target, opt) _append_cmake_configfile(target, installdir, "xxxConfig.cmake", opt) _install_cmake_configfile(target, installdir, "xxxConfigVersion.cmake", opt) _install_cmake_targetfile(target, installdir, "xxxTargets.cmake", opt) - if target:is_headeronly() then - _install_cmake_targetfile(target, installdir, "xxxTargets-headeronly.cmake", opt) - elseif is_mode("debug") then - _install_cmake_targetfile(target, installdir, "xxxTargets-debug.cmake", opt) - else - _install_cmake_targetfile(target, installdir, "xxxTargets-release.cmake", opt) + if not target:is_headeronly() then + if is_mode("debug") then + _install_cmake_targetfile(target, installdir, "xxxTargets-debug.cmake", opt) + else + _install_cmake_targetfile(target, installdir, "xxxTargets-release.cmake", opt) + end end end |
