diff options
author | Sean Cross <sean@xobs.io> | 2019-09-10 23:12:31 +0800 |
---|---|---|
committer | Sean Cross <sean@xobs.io> | 2019-09-10 23:12:31 +0800 |
commit | 0d0056a043510d70a39faa84ec0a0db8684c480b (patch) | |
tree | 24313b217c2b42d12b28bbaeb64666d695a83819 | |
parent | f98960b9361862d956df59f8129b01005ea41b5c (diff) | |
download | nextpnr-0d0056a043510d70a39faa84ec0a0db8684c480b.tar.gz nextpnr-0d0056a043510d70a39faa84ec0a0db8684c480b.tar.bz2 nextpnr-0d0056a043510d70a39faa84ec0a0db8684c480b.zip |
cmake: fix static build on Linux
When building Python, many extra libraries must be included, such
as expat and zlib.
Signed-off-by: Sean Cross <sean@xobs.io>
-rw-r--r-- | CMakeLists.txt | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 77745f95..67b0c18b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,13 @@ if (STATIC_BUILD) add_definitions(-DBOOST_PYTHON_STATIC_LIB) endif() else() + set(CMAKE_FIND_LIBRARY_SUFFIXES ".a" ".so") set(link_param "-static") + if (BUILD_PYTHON) + find_package(ZLIB) + find_package(EXPAT) + find_package(Threads) + endif() endif() endif() @@ -267,6 +273,14 @@ foreach (family ${ARCH}) endif() if (BUILD_PYTHON) target_link_libraries(${target} LINK_PUBLIC ${PYTHON_LIBRARIES}) + if (STATIC_BUILD) + target_link_libraries(${target} LINK_PUBLIC ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS} ${ZLIB_LIBRARIES} ${EXPAT_LIBRARIES} -lutil) + if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows" AND MSVC) + else() + target_link_libraries(${target} LINK_PUBLIC -lutil) + endif() + endif() endif() endforeach (target) endforeach (family) |