2020-12-02 20:42:35 +01:00
|
|
|
From 17539ae9d09ded695167911f9e3ec0cf4bc9fed9 Mon Sep 17 00:00:00 2001
|
2020-02-06 14:21:32 +01:00
|
|
|
From: Yegor Yefremov <yegorslists@googlemail.com>
|
|
|
|
Date: Wed, 5 Feb 2020 12:28:44 +0100
|
|
|
|
Subject: [PATCH] CMake: fix object library usage
|
|
|
|
|
|
|
|
Object libraries cannot be use in target_link_libraries() command
|
|
|
|
as they are no normal binary files like *.a or *.so but a collection
|
|
|
|
of object files.
|
|
|
|
|
|
|
|
See add_library() definition for details.
|
|
|
|
|
|
|
|
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
|
2020-12-02 20:42:35 +01:00
|
|
|
[Rebased for for ninja-1.10.2]
|
|
|
|
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
|
2020-02-06 14:21:32 +01:00
|
|
|
---
|
|
|
|
CMakeLists.txt | 9 ++++-----
|
|
|
|
1 file changed, 4 insertions(+), 5 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
2020-12-02 20:42:35 +01:00
|
|
|
index 4b61479..3701f3a 100644
|
2020-02-06 14:21:32 +01:00
|
|
|
--- a/CMakeLists.txt
|
|
|
|
+++ b/CMakeLists.txt
|
2020-12-02 20:42:35 +01:00
|
|
|
@@ -132,8 +132,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "OS400" OR CMAKE_SYSTEM_NAME STREQUAL "AIX")
|
2020-02-06 14:21:32 +01:00
|
|
|
endif()
|
2020-12-02 20:42:35 +01:00
|
|
|
|
2020-02-06 14:21:32 +01:00
|
|
|
# Main executable is library plus main() function.
|
|
|
|
-add_executable(ninja src/ninja.cc)
|
|
|
|
-target_link_libraries(ninja PRIVATE libninja libninja-re2c)
|
|
|
|
+add_executable(ninja src/ninja.cc $<TARGET_OBJECTS:libninja> $<TARGET_OBJECTS:libninja-re2c>)
|
2020-12-02 20:42:35 +01:00
|
|
|
|
|
|
|
# Adds browse mode into the ninja binary if it's supported by the host platform.
|
|
|
|
if(platform_supports_ninja_browse)
|
|
|
|
@@ -183,11 +182,12 @@ if(BUILD_TESTING)
|
|
|
|
src/subprocess_test.cc
|
|
|
|
src/test.cc
|
|
|
|
src/util_test.cc
|
|
|
|
+ $<TARGET_OBJECTS:libninja>
|
|
|
|
+ $<TARGET_OBJECTS:libninja-re2c>
|
|
|
|
)
|
|
|
|
if(WIN32)
|
|
|
|
target_sources(ninja_test PRIVATE src/includes_normalize_test.cc src/msvc_helper_test.cc)
|
|
|
|
endif()
|
|
|
|
- target_link_libraries(ninja_test PRIVATE libninja libninja-re2c)
|
|
|
|
|
|
|
|
foreach(perftest
|
|
|
|
build_log_perftest
|
|
|
|
@@ -197,8 +197,7 @@ if(BUILD_TESTING)
|
|
|
|
hash_collision_bench
|
|
|
|
manifest_parser_perftest
|
|
|
|
)
|
|
|
|
- add_executable(${perftest} src/${perftest}.cc)
|
|
|
|
- target_link_libraries(${perftest} PRIVATE libninja libninja-re2c)
|
|
|
|
+ add_executable(${perftest} src/${perftest}.cc $<TARGET_OBJECTS:libninja> $<TARGET_OBJECTS:libninja-re2c>)
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "AIX" AND CMAKE_SIZEOF_VOID_P EQUAL 4)
|
|
|
|
--
|
|
|
|
2.29.2
|
2020-02-06 14:21:32 +01:00
|
|
|
|