summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-10-20 00:43:14 +0800
committerruki <[email protected]>2021-10-20 00:43:14 +0800
commit6cc23f1211ea6f635393e9d6a02ef93857bca9ab (patch)
tree1fbc64996aa6b37ac183c0577b675af4f95bdf30
parent1c92df260a519c84b647a07da5f7a85b4d792ff1 (diff)
fix cmake importfiles for headeronly
-rw-r--r--xmake/modules/cli/amalgamate.lua4
-rw-r--r--xmake/modules/target/action/install/cmake_importfiles.lua14
-rw-r--r--xmake/scripts/cmake_importfiles/xxxTargets-headeronly.cmake9
3 files changed, 9 insertions, 18 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
diff --git a/xmake/scripts/cmake_importfiles/xxxTargets-headeronly.cmake b/xmake/scripts/cmake_importfiles/xxxTargets-headeronly.cmake
deleted file mode 100644
index c35a310a4..000000000
--- a/xmake/scripts/cmake_importfiles/xxxTargets-headeronly.cmake
+++ /dev/null
@@ -1,9 +0,0 @@
-#----------------------------------------------------------------
-# Generated CMake target import file for configuration "Headeronly".
-#----------------------------------------------------------------
-
-# Commands may need to know the format version.
-set(CMAKE_IMPORT_FILE_VERSION 1)
-
-# Commands beyond this point should not need to know the version.
-set(CMAKE_IMPORT_FILE_VERSION)