aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-12-19 00:45:23 +0800
committerGitHub <noreply@github.com>2018-12-19 00:45:23 +0800
commite970590675f0d4950e58d93852cd60e4fae98d8c (patch)
tree171bc63a61bc93c9dfb055437e6074e83b7db7f2
parentd959407f66d91ec5f7b05947193d58ae5b9468a9 (diff)
parent2f698b6efe1b1bb932b238a5dd912b290978ac72 (diff)
downloaddexon-solidity-e970590675f0d4950e58d93852cd60e4fae98d8c.tar.gz
dexon-solidity-e970590675f0d4950e58d93852cd60e4fae98d8c.tar.zst
dexon-solidity-e970590675f0d4950e58d93852cd60e4fae98d8c.zip
Merge pull request #5664 from ethereum/cmakeUpdates
Use imported CMake targets.
-rw-r--r--cmake/FindCLN.cmake5
-rw-r--r--cmake/FindCVC4.cmake11
-rw-r--r--cmake/FindGMP.cmake7
-rw-r--r--cmake/FindZ3.cmake9
-rw-r--r--cmake/jsoncpp.cmake1
-rw-r--r--libdevcore/CMakeLists.txt2
-rw-r--r--libsolidity/CMakeLists.txt6
7 files changed, 31 insertions, 10 deletions
diff --git a/cmake/FindCLN.cmake b/cmake/FindCLN.cmake
index f2234bb4..0b574ab9 100644
--- a/cmake/FindCLN.cmake
+++ b/cmake/FindCLN.cmake
@@ -1,3 +1,8 @@
find_library(CLN_LIBRARY NAMES cln)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CLN DEFAULT_MSG CLN_LIBRARY)
+
+if(CLN_FOUND AND NOT TARGET CLN::CLN)
+ add_library(CLN::CLN UNKNOWN IMPORTED)
+ set_property(TARGET CLN::CLN PROPERTY IMPORTED_LOCATION ${CLN_LIBRARY})
+endif()
diff --git a/cmake/FindCVC4.cmake b/cmake/FindCVC4.cmake
index 2649d7c7..887b907b 100644
--- a/cmake/FindCVC4.cmake
+++ b/cmake/FindCVC4.cmake
@@ -14,12 +14,19 @@ if (USE_CVC4)
set(CVC4_LIBRARIES ${CVC4_LIBRARY})
if (CLN_FOUND)
- set(CVC4_LIBRARIES ${CVC4_LIBRARIES} ${CLN_LIBRARY})
+ set(CVC4_LIBRARIES ${CVC4_LIBRARIES} CLN::CLN)
endif ()
if (GMP_FOUND)
- set(CVC4_LIBRARIES ${CVC4_LIBRARIES} ${GMP_LIBRARY})
+ set(CVC4_LIBRARIES ${CVC4_LIBRARIES} GMP::GMP)
endif ()
+
+ if (NOT TARGET CVC4::CVC4)
+ add_library(CVC4::CVC4 UNKNOWN IMPORTED)
+ set_property(TARGET CVC4::CVC4 PROPERTY IMPORTED_LOCATION ${CVC4_LIBRARY})
+ set_property(TARGET CVC4::CVC4 PROPERTY INTERFACE_LINK_LIBRARIES ${CVC4_LIBRARIES})
+ set_property(TARGET CVC4::CVC4 PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${CVC4_INCLUDE_DIR})
+ endif()
endif()
else()
set(CVC4_FOUND FALSE)
diff --git a/cmake/FindGMP.cmake b/cmake/FindGMP.cmake
index 8abe354c..c3a02654 100644
--- a/cmake/FindGMP.cmake
+++ b/cmake/FindGMP.cmake
@@ -1,3 +1,8 @@
-find_library(GMP_LIBRARY NAMES gmp )
+find_library(GMP_LIBRARY NAMES gmp)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GMP DEFAULT_MSG GMP_LIBRARY)
+
+if(GMP_FOUND AND NOT TARGET GMP::GMP)
+ add_library(GMP::GMP UNKNOWN IMPORTED)
+ set_property(TARGET GMP::GMP PROPERTY IMPORTED_LOCATION ${GMP_LIBRARY})
+endif()
diff --git a/cmake/FindZ3.cmake b/cmake/FindZ3.cmake
index c017cac2..ad34cbc3 100644
--- a/cmake/FindZ3.cmake
+++ b/cmake/FindZ3.cmake
@@ -1,9 +1,14 @@
if (USE_Z3)
find_path(Z3_INCLUDE_DIR NAMES z3++.h PATH_SUFFIXES z3)
- find_library(Z3_LIBRARY NAMES z3 )
+ find_library(Z3_LIBRARY NAMES z3)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Z3 DEFAULT_MSG Z3_LIBRARY Z3_INCLUDE_DIR)
+
+ if (NOT TARGET Z3::Z3)
+ add_library(Z3::Z3 UNKNOWN IMPORTED)
+ set_property(TARGET Z3::Z3 PROPERTY IMPORTED_LOCATION ${Z3_LIBRARY})
+ set_property(TARGET Z3::Z3 PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Z3_INCLUDE_DIR})
+ endif()
else()
set(Z3_FOUND FALSE)
endif()
-# TODO: Create IMPORTED library for Z3.
diff --git a/cmake/jsoncpp.cmake b/cmake/jsoncpp.cmake
index 318a526e..4db7b9c3 100644
--- a/cmake/jsoncpp.cmake
+++ b/cmake/jsoncpp.cmake
@@ -51,5 +51,6 @@ ExternalProject_Add(jsoncpp-project
add_library(jsoncpp STATIC IMPORTED)
file(MAKE_DIRECTORY ${JSONCPP_INCLUDE_DIR}) # Must exist.
set_property(TARGET jsoncpp PROPERTY IMPORTED_LOCATION ${JSONCPP_LIBRARY})
+set_property(TARGET jsoncpp PROPERTY INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${JSONCPP_INCLUDE_DIR})
set_property(TARGET jsoncpp PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${JSONCPP_INCLUDE_DIR})
add_dependencies(jsoncpp jsoncpp-project)
diff --git a/libdevcore/CMakeLists.txt b/libdevcore/CMakeLists.txt
index e2309b16..e68ac10a 100644
--- a/libdevcore/CMakeLists.txt
+++ b/libdevcore/CMakeLists.txt
@@ -30,7 +30,7 @@ set(sources
)
add_library(devcore ${sources})
-target_link_libraries(devcore PRIVATE jsoncpp ${Boost_FILESYSTEM_LIBRARIES} ${Boost_REGEX_LIBRARIES} ${Boost_SYSTEM_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
+target_link_libraries(devcore PUBLIC jsoncpp ${Boost_FILESYSTEM_LIBRARIES} ${Boost_REGEX_LIBRARIES} ${Boost_SYSTEM_LIBRARIES} Threads::Threads)
target_include_directories(devcore PUBLIC "${CMAKE_SOURCE_DIR}")
target_include_directories(devcore SYSTEM PUBLIC ${Boost_INCLUDE_DIRS})
add_dependencies(devcore solidity_BuildInfo.h)
diff --git a/libsolidity/CMakeLists.txt b/libsolidity/CMakeLists.txt
index 389f94bd..8c2ab347 100644
--- a/libsolidity/CMakeLists.txt
+++ b/libsolidity/CMakeLists.txt
@@ -104,7 +104,6 @@ set(sources
find_package(Z3 QUIET)
if (${Z3_FOUND})
- include_directories(${Z3_INCLUDE_DIR})
add_definitions(-DHAVE_Z3)
message("Z3 SMT solver found. This enables optional SMT checking with Z3.")
set(z3_SRCS formal/Z3Interface.cpp formal/Z3Interface.h)
@@ -114,7 +113,6 @@ endif()
find_package(CVC4 QUIET)
if (${CVC4_FOUND})
- include_directories(${CVC4_INCLUDE_DIR})
add_definitions(-DHAVE_CVC4)
message("CVC4 SMT solver found. This enables optional SMT checking with CVC4.")
set(cvc4_SRCS formal/CVC4Interface.cpp formal/CVC4Interface.h)
@@ -131,9 +129,9 @@ add_library(solidity ${sources} ${z3_SRCS} ${cvc4_SRCS})
target_link_libraries(solidity PUBLIC yul evmasm langutil devcore ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY})
if (${Z3_FOUND})
- target_link_libraries(solidity PUBLIC ${Z3_LIBRARY})
+ target_link_libraries(solidity PUBLIC Z3::Z3)
endif()
if (${CVC4_FOUND})
- target_link_libraries(solidity PUBLIC ${CVC4_LIBRARIES})
+ target_link_libraries(solidity PUBLIC CVC4::CVC4)
endif()