diff options
| author | ruki <[email protected]> | 2021-09-29 00:54:57 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-09-29 00:54:57 +0800 |
| commit | 89d9924b0f86e2d650bfc719d87e9484ba52efcf (patch) | |
| tree | 9534eeabe459b6027e77a8107349a70734608ccf /tests/projects | |
| parent | 78a086ae1bb8347e281e8561114eab5013e41c47 (diff) | |
improve cmakelists
Diffstat (limited to 'tests/projects')
| -rw-r--r-- | tests/projects/c/library_with_cmakelists/foo/CMakeLists.txt | 7 | ||||
| -rw-r--r-- | tests/projects/c/library_with_cmakelists/xmake.lua | 4 |
2 files changed, 8 insertions, 3 deletions
diff --git a/tests/projects/c/library_with_cmakelists/foo/CMakeLists.txt b/tests/projects/c/library_with_cmakelists/foo/CMakeLists.txt index 4eca38b21..0745681e0 100644 --- a/tests/projects/c/library_with_cmakelists/foo/CMakeLists.txt +++ b/tests/projects/c/library_with_cmakelists/foo/CMakeLists.txt @@ -5,4 +5,11 @@ add_library(foo STATIC "") target_sources(foo PRIVATE src/foo.c ) +set_target_properties(foo PROPERTIES PUBLIC_HEADER src/foo.h) +include(GNUInstallDirs) +install(TARGETS foo + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) diff --git a/tests/projects/c/library_with_cmakelists/xmake.lua b/tests/projects/c/library_with_cmakelists/xmake.lua index bc3260373..4bf632e08 100644 --- a/tests/projects/c/library_with_cmakelists/xmake.lua +++ b/tests/projects/c/library_with_cmakelists/xmake.lua @@ -7,9 +7,7 @@ package("foo") local configs = {} table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) - import("package.tools.cmake").build(package, configs, {buildir = "build"}) - os.cp("src/*.h", package:installdir("include")) - os.cp("build/*.a", package:installdir("lib")) + import("package.tools.cmake").install(package, configs, {buildir = "build"}) end) on_test(function (package) assert(package:has_cincludes("foo.h")) |
