summaryrefslogtreecommitdiff
path: root/cmake/FindPoly.cmake
diff options
context:
space:
mode:
authorGereon Kremer <nafur42@gmail.com>2021-09-30 12:15:24 -0700
committerGitHub <noreply@github.com>2021-09-30 19:15:24 +0000
commit65e5a909b10855d2e6b3844f7bc4efb7fbe4fe2f (patch)
treebb541a32e3985be59ffdc323038677bbace24ede /cmake/FindPoly.cmake
parent5a824c9e67789a529e34b7e2a7229986412bf979 (diff)
Refactor our static builds (#7251)
This PR does a major refactoring on how we organize our builds to allow both shared and static builds. We now build the libraries using object libraries to allow building the libraries both dynamically and statically in the same build folder, though the static library is optional (ENABLE_STATIC_LIBRARY). The binary is linked either dynamically or statically (depending on ENABLE_STATIC_BINARY).
Diffstat (limited to 'cmake/FindPoly.cmake')
-rw-r--r--cmake/FindPoly.cmake12
1 files changed, 8 insertions, 4 deletions
diff --git a/cmake/FindPoly.cmake b/cmake/FindPoly.cmake
index e11d85c3f..6ddb918a9 100644
--- a/cmake/FindPoly.cmake
+++ b/cmake/FindPoly.cmake
@@ -66,8 +66,8 @@ if(NOT Poly_FOUND_SYSTEM)
unset(patchcmd)
endif()
- get_target_property(GMP_INCLUDE_DIR GMP INTERFACE_INCLUDE_DIRECTORIES)
- get_target_property(GMP_LIBRARY GMP IMPORTED_LOCATION)
+ get_target_property(GMP_INCLUDE_DIR GMP_SHARED INTERFACE_INCLUDE_DIRECTORIES)
+ get_target_property(GMP_LIBRARY GMP_SHARED IMPORTED_LOCATION)
get_filename_component(GMP_LIB_PATH "${GMP_LIBRARY}" DIRECTORY)
ExternalProject_Add(
@@ -101,7 +101,7 @@ if(NOT Poly_FOUND_SYSTEM)
DEPENDEES install
COMMAND ${CMAKE_COMMAND} -E remove_directory <BINARY_DIR>/test/
)
- add_dependencies(Poly-EP GMP)
+ add_dependencies(Poly-EP GMP_SHARED)
set(Poly_INCLUDE_DIR "${DEPS_BASE}/include/")
set(Poly_LIBRARIES "${DEPS_BASE}/lib/libpicpoly.a")
@@ -115,7 +115,11 @@ set_target_properties(Poly PROPERTIES IMPORTED_LOCATION "${Poly_LIBRARIES}")
set_target_properties(
Poly PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${Poly_INCLUDE_DIR}"
)
-target_link_libraries(Poly INTERFACE GMP)
+if(ENABLE_STATIC_LIBRARY)
+ target_link_libraries(Poly INTERFACE GMP_STATIC)
+else()
+ target_link_libraries(Poly INTERFACE GMP_SHARED)
+endif()
add_library(Polyxx STATIC IMPORTED GLOBAL)
set_target_properties(Polyxx PROPERTIES IMPORTED_LOCATION "${PolyXX_LIBRARIES}")
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback