You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
2.7 KiB
70 lines
2.7 KiB
From 4fa85f00f824b1dd5d1244c77667ea497d94f02b Mon Sep 17 00:00:00 2001
|
|
From: Andreas Sturmlechner <asturm@gentoo.org>
|
|
Date: Sat, 11 Jul 2020 21:11:58 +0200
|
|
Subject: [PATCH] Do not build static lib if BUILD_STATICALLY_LINKED_EXE=OFF
|
|
|
|
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
|
|
---
|
|
src/lib/CMakeLists.txt | 36 +++++++++++++++++++++++-------------
|
|
1 file changed, 23 insertions(+), 13 deletions(-)
|
|
|
|
diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt
|
|
index 353ab1c..12db621 100644
|
|
--- a/src/lib/CMakeLists.txt
|
|
+++ b/src/lib/CMakeLists.txt
|
|
@@ -44,16 +44,18 @@ if(WIN32)
|
|
endif()
|
|
target_link_libraries(editorconfig_shared ${PCRE2_LIBRARIES})
|
|
|
|
-add_library(editorconfig_static STATIC ${editorconfig_LIBSRCS})
|
|
-set_target_properties(editorconfig_static PROPERTIES
|
|
- OUTPUT_NAME editorconfig_static
|
|
- VERSION ${PROJECT_VERSION})
|
|
+if(BUILD_STATICALLY_LINKED_EXE)
|
|
+ add_library(editorconfig_static STATIC ${editorconfig_LIBSRCS})
|
|
+ set_target_properties(editorconfig_static PROPERTIES
|
|
+ OUTPUT_NAME editorconfig_static
|
|
+ VERSION ${PROJECT_VERSION})
|
|
|
|
-# We need to link Shwapi since we use PathIsRelative
|
|
-if(WIN32)
|
|
- target_link_libraries(editorconfig_static Shlwapi)
|
|
+ # We need to link Shwapi since we use PathIsRelative
|
|
+ if(WIN32)
|
|
+ target_link_libraries(editorconfig_static Shlwapi)
|
|
+ endif()
|
|
+ target_link_libraries(editorconfig_static ${PCRE2_LIBRARIES})
|
|
endif()
|
|
-target_link_libraries(editorconfig_static ${PCRE2_LIBRARIES})
|
|
|
|
# EditorConfig package name for find_package() and the CMake package registry.
|
|
# On UNIX the system registry is usually just "lib/cmake/<package>".
|
|
@@ -65,11 +67,19 @@ set(editorconfig_CONFIG_EXPORT_NAME "${config_package_name}Targets")
|
|
set(editorconfig_CONFIG_INSTALL_LIBDIR
|
|
"${CMAKE_INSTALL_LIBDIR}/cmake/${config_package_name}")
|
|
|
|
-install(TARGETS editorconfig_shared editorconfig_static
|
|
- EXPORT ${editorconfig_CONFIG_EXPORT_NAME}
|
|
- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
+if(BUILD_STATICALLY_LINKED_EXE)
|
|
+ install(TARGETS editorconfig_static
|
|
+ EXPORT ${editorconfig_CONFIG_EXPORT_NAME}
|
|
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
+else()
|
|
+ install(TARGETS editorconfig_shared
|
|
+ EXPORT ${editorconfig_CONFIG_EXPORT_NAME}
|
|
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
+endif()
|
|
|
|
configure_file(
|
|
${CMAKE_CURRENT_SOURCE_DIR}/editorconfig.pc.in
|
|
--
|
|
2.27.0
|
|
|