From 3f4b33522bd04b509b73267550d24c44e61998ce Mon Sep 17 00:00:00 2001 From: Gereon Kremer Date: Thu, 1 Apr 2021 20:20:53 +0200 Subject: [PATCH] Refactor CLN dependency & Cleanup (#6251) This PR migrates CLN to a new Find script and adds the possibility to install CLN if not found in the system. Also, it does a bit of cleanup. --- CMakeLists.txt | 45 +------------- cmake/FindANTLR3.cmake | 12 ++-- cmake/FindCLN.cmake | 82 +++++++++++++++++++------ cmake/FindCaDiCaL.cmake | 2 +- cmake/FindCryptoMiniSat.cmake | 2 +- cmake/FindDummy.cmake.template | 4 +- cmake/FindGMP.cmake | 3 +- cmake/FindGTest.cmake | 2 +- cmake/FindKissat.cmake | 2 +- cmake/FindPoly.cmake | 4 +- cmake/FindSymFPU.cmake | 2 +- cmake/deps-helper.cmake | 16 +++++ cmake/deps-utils/Poly-patch-cmake.patch | 13 ++++ configure.sh | 12 ---- src/CMakeLists.txt | 3 +- src/api/python/CMakeLists.txt | 2 +- src/main/CMakeLists.txt | 25 ++++---- test/api/CMakeLists.txt | 7 +-- test/unit/CMakeLists.txt | 13 ++-- 19 files changed, 130 insertions(+), 121 deletions(-) create mode 100644 cmake/deps-utils/Poly-patch-cmake.patch diff --git a/CMakeLists.txt b/CMakeLists.txt index a8c1e2e0d..c6909d216 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,27 +61,9 @@ endif() if(ABC_DIR) list(APPEND CMAKE_PREFIX_PATH "${ABC_DIR}") endif() -if(CADICAL_DIR) - list(APPEND CMAKE_PREFIX_PATH "${CADICAL_DIR}") -endif() -if(CRYPTOMINISAT_DIR) - list(APPEND CMAKE_PREFIX_PATH "${CRYPTOMINISAT_DIR}") -endif() if(GLPK_DIR) list(APPEND CMAKE_PREFIX_PATH "${GLPK_DIR}") endif() -if(GMP_DIR) - list(APPEND CMAKE_PREFIX_PATH "${GMP_DIR}") -endif() -if(KISSAT_DIR) - list(APPEND CMAKE_PREFIX_PATH "${KISSAT_DIR}") -endif() -if(POLY_DIR) - list(APPEND CMAKE_PREFIX_PATH "${POLY_DIR}") -endif() -if(SYMFPU_DIR) - list(APPEND CMAKE_PREFIX_PATH "${SYMFPU_DIR}") -endif() # By default the contrib/get-* scripts install dependencies to deps/install. list(APPEND CMAKE_PREFIX_PATH "${PROJECT_SOURCE_DIR}/deps/install") @@ -148,13 +130,7 @@ option(USE_PYTHON2 "Force Python 2 (deprecated)") # check the intalled system version. If the user provides a directory we # immediately fail if the dependency was not found at the specified location. set(ABC_DIR "" CACHE STRING "Set ABC install directory") -set(CADICAL_DIR "" CACHE STRING "Set CaDiCaL install directory") -set(CRYPTOMINISAT_DIR "" CACHE STRING "Set CryptoMiniSat install directory") set(GLPK_DIR "" CACHE STRING "Set GLPK install directory") -set(GMP_DIR "" CACHE STRING "Set GMP install directory") -set(KISSAT_DIR "" CACHE STRING "Set Kissat install directory") -set(POLY_DIR "" CACHE STRING "Set LibPoly install directory") -set(SYMFPU_DIR "" CACHE STRING "Set SymFPU install directory") # Prepend binaries with prefix on make install set(PROGRAM_PREFIX "" CACHE STRING "Program prefix on make install") @@ -341,7 +317,7 @@ else() find_package(PythonInterp 3 REQUIRED) endif() -find_package(GMP REQUIRED) +find_package(GMP 6.2 REQUIRED) if(ENABLE_ASAN) # -fsanitize=address requires CMAKE_REQUIRED_FLAGS to be explicitely set, @@ -686,28 +662,9 @@ message("") if(ABC_DIR) print_config("ABC dir " ${ABC_DIR}) endif() -if(CADICAL_DIR) - print_config("CADICAL dir " ${CADICAL_DIR}) -endif() -if(CRYPTOMINISAT_DIR) - print_config("CRYPTOMINISAT dir " ${CRYPTOMINISAT_DIR}) -endif() if(GLPK_DIR) print_config("GLPK dir " ${GLPK_DIR}) endif() -if(GMP_DIR) - print_config("GMP dir " ${GMP_DIR}) -endif() -if(KISSAT_DIR) - print_config("KISSAT dir " ${KISSAT_DIR}) -endif() -if(POLY_DIR) - print_config("LibPoly dir " ${POLY_DIR}) -endif() -if(SYMFPU_DIR) - print_config("SYMFPU dir " ${SYMFPU_DIR}) -endif() -print_config("asdf" "") message("") print_config("CPPLAGS (-D...)" "${CVC4_DEFINITIONS}") print_config("CXXFLAGS " "${CMAKE_CXX_FLAGS}") diff --git a/cmake/FindANTLR3.cmake b/cmake/FindANTLR3.cmake index 58ba1cf65..76e5253fe 100644 --- a/cmake/FindANTLR3.cmake +++ b/cmake/FindANTLR3.cmake @@ -38,7 +38,7 @@ if(NOT ANTLR3_FOUND_SYSTEM) # Download antlr generator jar ExternalProject_Add( ANTLR3-EP-jar - PREFIX ${DEPS_PREFIX} + ${COMMON_EP_CONFIG} URL https://www.antlr3.org/download/antlr-${ANTLR3_VERSION}-complete.jar URL_HASH SHA1=5cab59d859caa6598e28131d30dd2e89806db57f DOWNLOAD_NO_EXTRACT ON @@ -53,7 +53,7 @@ if(NOT ANTLR3_FOUND_SYSTEM) # Download config guess ExternalProject_Add( ANTLR3-EP-config.guess - PREFIX ${DEPS_PREFIX} + ${COMMON_EP_CONFIG} URL "http://git.savannah.gnu.org/gitweb/?p=config.git\\\;a=blob_plain\\\;f=config.guess\\\;hb=HEAD" DOWNLOAD_NAME config.guess DOWNLOAD_NO_EXTRACT ON @@ -72,16 +72,14 @@ if(NOT ANTLR3_FOUND_SYSTEM) # Download, build and install antlr3 runtime ExternalProject_Add( ANTLR3-EP-runtime + ${COMMON_EP_CONFIG} DEPENDS ANTLR3-EP-config.guess - PREFIX ${DEPS_PREFIX} URL https://www.antlr3.org/download/C/libantlr3c-3.4.tar.gz URL_HASH SHA1=faa9ab43ab4d3774f015471c3f011cc247df6a18 CONFIGURE_COMMAND ${CMAKE_COMMAND} -E copy /../config.guess /config.guess - COMMAND sed "s/avr32 \\\\/avr32 | aarch64 \\\\/" - /config.sub > /config.sub.new - COMMAND ${CMAKE_COMMAND} -E copy - /config.sub.new /config.sub + COMMAND sed -i.orig "s/avr | avr32/avr | aarch64 | avr32/" + /config.sub COMMAND ${CMAKE_COMMAND} -E copy_directory /include include/ COMMAND /configure --with-pic diff --git a/cmake/FindCLN.cmake b/cmake/FindCLN.cmake index aeb84dcea..25ca903af 100644 --- a/cmake/FindCLN.cmake +++ b/cmake/FindCLN.cmake @@ -13,28 +13,72 @@ # CLN_INCLUDE_DIR - the CLN include directory # CLN_LIBRARIES - Libraries needed to use CLN +include(deps-helper) + find_path(CLN_INCLUDE_DIR NAMES cln/cln.h) find_library(CLN_LIBRARIES NAMES cln) +set(CLN_FOUND_SYSTEM FALSE) +if(CLN_INCLUDE_DIR AND CLN_LIBRARIES) + set(CLN_FOUND_SYSTEM TRUE) + + file(STRINGS ${CLN_INCLUDE_DIR}/cln/version.h CLN_VERSION + REGEX "^#define[\t ]+CL_VERSION .*" + ) + string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" CLN_VERSION "${CLN_VERSION}") + + check_system_version("CLN") +endif() + +if(NOT CLN_FOUND_SYSTEM) + include(ExternalProject) + + fail_if_cross_compiling("Windows" "" "CLN" "autoconf fails") + fail_if_cross_compiling("" "arm" "CLN" "syntax error in configure") + + set(CLN_VERSION "1.3.6") + string(REPLACE "." "-" CLN_TAG ${CLN_VERSION}) -if(CLN_INCLUDE_DIR) - file(STRINGS - "${CLN_INCLUDE_DIR}/cln/version.h" version_info - REGEX "^#define[ \t]+CL_VERSION_.*") - string(REGEX REPLACE - "^.*_MAJOR[ \t]+([0-9]+).*" "\\1" version_major "${version_info}") - string(REGEX REPLACE - "^.*_MINOR[ \t]+([0-9]+).*" "\\1" version_minor "${version_info}") - string(REGEX REPLACE - "^.*_PATCHLEVEL[ \t]+([0-9]+).*" "\\1" version_patch "${version_info}") - set(CLN_VERSION ${version_major}.${version_minor}.${version_patch}) - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(CLN - REQUIRED_VARS CLN_INCLUDE_DIR CLN_LIBRARIES - VERSION_VAR CLN_VERSION) - mark_as_advanced(CLN_INCLUDE_DIR CLN_LIBRARIES) + find_program(AUTORECONF autoreconf) + if(NOT AUTORECONF) + message(SEND_ERROR "Can not build CLN, missing binary for autoreconf") + endif() + + ExternalProject_Add( + CLN-EP + ${COMMON_EP_CONFIG} + URL "https://www.ginac.de/CLN/cln.git/?p=cln.git\\\;a=snapshot\\\;h=cln_${CLN_TAG}\\\;sf=tgz" + URL_HASH SHA1=71d02b90ef0575f06b7bafb8690f73e8064d8228 + DOWNLOAD_NAME cln.tgz + CONFIGURE_COMMAND cd && ./autogen.sh && autoreconf -iv + COMMAND /configure --prefix= --disable-shared + --enable-static --with-pic + BUILD_BYPRODUCTS /lib/libcln.a + ) + + add_dependencies(CLN-EP GMP) + + set(CLN_INCLUDE_DIR "${DEPS_BASE}/include/") + set(CLN_LIBRARIES "${DEPS_BASE}/lib/libcln.a") endif() -if(CLN_LIBRARIES) - message(STATUS "Found CLN libs: ${CLN_LIBRARIES}") + +set(CLN_FOUND TRUE) + +add_library(CLN STATIC IMPORTED GLOBAL) +set_target_properties(CLN PROPERTIES IMPORTED_LOCATION "${CLN_LIBRARIES}") +set_target_properties( + CLN PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CLN_INCLUDE_DIR}" +) + +mark_as_advanced(AUTORECONF) +mark_as_advanced(CLN_FOUND) +mark_as_advanced(CLN_FOUND_SYSTEM) +mark_as_advanced(CLN_INCLUDE_DIR) +mark_as_advanced(CLN_LIBRARIES) + +if(CLN_FOUND_SYSTEM) + message(STATUS "Found CLN ${CLN_VERSION}: ${CLN_LIBRARIES}") +else() + message(STATUS "Building CLN ${CLN_VERSION}: ${CLN_LIBRARIES}") + add_dependencies(CLN CLN-EP) endif() diff --git a/cmake/FindCaDiCaL.cmake b/cmake/FindCaDiCaL.cmake index b9894a16d..c8490b8ca 100644 --- a/cmake/FindCaDiCaL.cmake +++ b/cmake/FindCaDiCaL.cmake @@ -55,7 +55,7 @@ if(NOT CaDiCaL_FOUND_SYSTEM) ExternalProject_Add( CaDiCaL-EP - PREFIX ${DEPS_PREFIX} + ${COMMON_EP_CONFIG} BUILD_IN_SOURCE ON URL https://github.com/arminbiere/cadical/archive/refs/tags/rel-${CaDiCaL_VERSION}.tar.gz URL_HASH SHA1=9de1176737b74440921ba86395fe5edbb3b131eb diff --git a/cmake/FindCryptoMiniSat.cmake b/cmake/FindCryptoMiniSat.cmake index 318907797..92b351ef2 100644 --- a/cmake/FindCryptoMiniSat.cmake +++ b/cmake/FindCryptoMiniSat.cmake @@ -38,7 +38,7 @@ if(NOT CryptoMiniSat_FOUND_SYSTEM) ExternalProject_Add( CryptoMiniSat-EP - PREFIX ${DEPS_PREFIX} + ${COMMON_EP_CONFIG} URL https://github.com/msoos/cryptominisat/archive/refs/tags/${CryptoMiniSat_VERSION}.tar.gz URL_HASH SHA1=f79dfa1ffc6c9c75b3a33f76d3a89a3df2b3f4c2 PATCH_COMMAND diff --git a/cmake/FindDummy.cmake.template b/cmake/FindDummy.cmake.template index ecb7f672b..f339e4f04 100644 --- a/cmake/FindDummy.cmake.template +++ b/cmake/FindDummy.cmake.template @@ -55,13 +55,13 @@ if(NOT Dummy_FOUND_SYSTEM) # declare some release, version, tag, commit set(Dummy_VERSION "1.2.3") # do whatever is necessary - # - set the proper install prefix + # - use some common config # - prefer URL to GIT (to avoid rebuilds) # - only build / install static versions if possible # - pass ${TOOLCHAIN_PREFIX} ExternalProject_Add( Dummy-EP - PREFIX ${DEPS_PREFIX} + ${COMMON_EP_CONFIG} URL https://dummy.org/download/dummy-${Dummy_VERSION}.tar.bz2 URL_HASH SHA1=abc123 CMAKE_ARGS diff --git a/cmake/FindGMP.cmake b/cmake/FindGMP.cmake index 7e81dfd19..59262593d 100644 --- a/cmake/FindGMP.cmake +++ b/cmake/FindGMP.cmake @@ -34,7 +34,6 @@ if(GMP_INCLUDE_DIR AND GMP_LIBRARIES) getversionpart(PATCH "${GMP_INCLUDE_DIR}/gmp.h" "VERSION_PATCHLEVEL") set(GMP_VERSION "${MAJOR}.${MINOR}.${PATCH}" - PARENT_SCOPE ) check_system_version("GMP") @@ -47,7 +46,7 @@ if(NOT GMP_FOUND_SYSTEM) ExternalProject_Add( GMP-EP - PREFIX ${DEPS_PREFIX} + ${COMMON_EP_CONFIG} URL https://gmplib.org/download/gmp/gmp-${GMP_VERSION}.tar.bz2 URL_HASH SHA1=2dcf34d4a432dbe6cce1475a835d20fe44f75822 CONFIGURE_COMMAND diff --git a/cmake/FindGTest.cmake b/cmake/FindGTest.cmake index 786a51b35..401f6d9a3 100644 --- a/cmake/FindGTest.cmake +++ b/cmake/FindGTest.cmake @@ -29,7 +29,7 @@ if(NOT GTest_FOUND_SYSTEM) ExternalProject_Add( GTest-EP - PREFIX ${DEPS_PREFIX} + ${COMMON_EP_CONFIG} URL https://github.com/google/googletest/archive/refs/tags/release-${GTest_VERSION}.tar.gz URL_HASH SHA1=9c89be7df9c5e8cb0bc20b3c4b39bf7e82686770 DOWNLOAD_NAME gtest.tar.gz diff --git a/cmake/FindKissat.cmake b/cmake/FindKissat.cmake index e71a64eea..f469f0197 100644 --- a/cmake/FindKissat.cmake +++ b/cmake/FindKissat.cmake @@ -45,7 +45,7 @@ if(NOT Kissat_FOUND_SYSTEM) ExternalProject_Add( Kissat-EP - PREFIX ${DEPS_PREFIX} + ${COMMON_EP_CONFIG} BUILD_IN_SOURCE ON URL http://fmv.jku.at/kissat/kissat-${Kissat_VERSION}.tar.xz URL_HASH SHA1=5125efa17d383c7e7c1e6d803e3422b17cebcedb diff --git a/cmake/FindPoly.cmake b/cmake/FindPoly.cmake index 3556a9d63..1bbb9fa65 100644 --- a/cmake/FindPoly.cmake +++ b/cmake/FindPoly.cmake @@ -19,7 +19,7 @@ find_path(Poly_INCLUDE_DIR NAMES poly/poly.h) find_library(Poly_LIBRARIES NAMES poly) find_library(PolyXX_LIBRARIES NAMES polyxx) -set(Dummy_FOUND_SYSTEM FALSE) +set(Poly_FOUND_SYSTEM FALSE) if(Poly_INCLUDE_DIR AND Poly_LIBRARIES AND PolyXX_LIBRARIES @@ -65,7 +65,7 @@ if(NOT Poly_FOUND_SYSTEM) ExternalProject_Add( Poly-EP - PREFIX ${DEPS_PREFIX} + ${COMMON_EP_CONFIG} URL https://github.com/SRI-CSL/libpoly/archive/${Poly_VERSION}.tar.gz URL_HASH SHA1=2e79d5220d3ecbb40811463fcf12c5ddbd4b9f30 DOWNLOAD_NAME libpoly.tar.gz diff --git a/cmake/FindSymFPU.cmake b/cmake/FindSymFPU.cmake index da8beac99..0a1d41c1a 100644 --- a/cmake/FindSymFPU.cmake +++ b/cmake/FindSymFPU.cmake @@ -26,7 +26,7 @@ else() ExternalProject_Add( SymFPU-EP - PREFIX ${DEPS_PREFIX} + ${COMMON_EP_CONFIG} URL https://github.com/martin-cs/symfpu/archive/${SymFPU_COMMIT}.tar.gz URL_HASH SHA1=9e00045130b93e3c2a46ce73a1b5b6451340dc46 CONFIGURE_COMMAND "" diff --git a/cmake/deps-helper.cmake b/cmake/deps-helper.cmake index 4b88d62ce..4de54e9ea 100644 --- a/cmake/deps-helper.cmake +++ b/cmake/deps-helper.cmake @@ -6,6 +6,22 @@ set(DEPS_BASE "${CMAKE_BINARY_DIR}/deps") # (and similar) to exist when target property is set. file(MAKE_DIRECTORY "${DEPS_BASE}/include/") +set(COMMON_EP_CONFIG + PREFIX ${DEPS_PREFIX} + LOG_DOWNLOAD ON + LOG_UPDATE ON + LOG_CONFIGURE ON + LOG_BUILD ON + LOG_INSTALL ON +) +if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.14") + set(COMMON_EP_CONFIG ${COMMON_EP_CONFIG} + LOG_PATCH ON + LOG_MERGED_STDOUTERR ON + LOG_OUTPUT_ON_FAILURE ON + ) +endif() + macro(check_system_version name) # find_package sets this variable when called with a version # https://cmake.org/cmake/help/latest/command/find_package.html#version-selection diff --git a/cmake/deps-utils/Poly-patch-cmake.patch b/cmake/deps-utils/Poly-patch-cmake.patch new file mode 100644 index 000000000..fe8528f70 --- /dev/null +++ b/cmake/deps-utils/Poly-patch-cmake.patch @@ -0,0 +1,13 @@ +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index f91e3e8..6205689 100755 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -38,7 +38,7 @@ set(poly_SOURCES + ) + + if (NOT HAVE_OPEN_MEMSTREAM) +- set(poly_SOURCES "utils/open_memstream.c ${poly_SOURCES}") ++ set(poly_SOURCES utils/open_memstream.c ${poly_SOURCES}) + endif() + + set(polyxx_SOURCES diff --git a/configure.sh b/configure.sh index 6e54caa09..63d40403a 100755 --- a/configure.sh +++ b/configure.sh @@ -328,18 +328,6 @@ do shift done -#--------------------------------------------------------------------------# -# Automatically set up dependencies based on configure options -#--------------------------------------------------------------------------# - -if [ "$arm64" == "ON" ]; then - echo "Setting up dependencies for ARM 64-bit build" - contrib/get-gmp-dev --host=aarch64-linux-gnu || exit 1 -elif [ "$win64" == "ON" ]; then - echo "Setting up dependencies for Windows 64-bit build" - contrib/get-gmp-dev --host=x86_64-w64-mingw32 || exit 1 -fi - #--------------------------------------------------------------------------# if [ $werror != default ]; then diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2679f6072..490d335a2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1134,8 +1134,7 @@ if(USE_CADICAL) target_link_libraries(cvc4 PRIVATE CaDiCaL) endif() if(USE_CLN) - target_link_libraries(cvc4 PRIVATE ${CLN_LIBRARIES}) - target_include_directories(cvc4 PRIVATE $) + target_link_libraries(cvc4 PRIVATE CLN) endif() if(USE_CRYPTOMINISAT) target_link_libraries(cvc4 PRIVATE CryptoMiniSat) diff --git a/src/api/python/CMakeLists.txt b/src/api/python/CMakeLists.txt index 62482a0ba..ec156e50e 100644 --- a/src/api/python/CMakeLists.txt +++ b/src/api/python/CMakeLists.txt @@ -36,7 +36,7 @@ add_custom_target( --kinds-header "${PROJECT_SOURCE_DIR}/src/api/cvc4cppkind.h" --kinds-file-prefix "${CMAKE_CURRENT_BINARY_DIR}/cvc4kinds" DEPENDS - genkinds.py + "${CMAKE_CURRENT_BINARY_DIR}/genkinds.py" COMMENT "Generate cvc4kinds.{pxd,pyx}" ) diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index 2d2b08378..fd2d415b2 100644 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -41,22 +41,20 @@ add_dependencies(main cvc4 cvc4parser gen-tokens) get_target_property(LIBCVC4_INCLUDES cvc4 INCLUDE_DIRECTORIES) target_include_directories(main PRIVATE ${LIBCVC4_INCLUDES}) if(USE_CLN) - target_link_libraries(main ${CLN_LIBRARIES}) - target_include_directories(main PRIVATE $) + target_link_libraries(main PUBLIC CLN) endif() -target_link_libraries(main GMP) +target_link_libraries(main PUBLIC GMP) # main-test library is only used for linking against api and unit tests so # that we don't have to include all object files of main into each api/unit # test. Do not link against main-test in any other case. add_library(main-test driver_unified.cpp $) target_compile_definitions(main-test PRIVATE -D__BUILDING_CVC4DRIVER) -target_link_libraries(main-test cvc4 cvc4parser) +target_link_libraries(main-test PUBLIC cvc4 cvc4parser) if(USE_CLN) - target_link_libraries(main-test ${CLN_LIBRARIES}) - target_include_directories(main-test PRIVATE $) + target_link_libraries(main-test PUBLIC CLN) endif() -target_link_libraries(main-test GMP) +target_link_libraries(main-test PUBLIC GMP) #-----------------------------------------------------------------------------# # cvc4 binary configuration @@ -67,12 +65,11 @@ set_target_properties(cvc4-bin PROPERTIES OUTPUT_NAME cvc4 RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) -target_link_libraries(cvc4-bin cvc4 cvc4parser) +target_link_libraries(cvc4-bin PUBLIC cvc4 cvc4parser) if(USE_CLN) - target_link_libraries(cvc4-bin ${CLN_LIBRARIES}) - target_include_directories(cvc4-bin PRIVATE $) + target_link_libraries(cvc4-bin PUBLIC CLN) endif() -target_link_libraries(cvc4-bin GMP) +target_link_libraries(cvc4-bin PUBLIC GMP) if(PROGRAM_PREFIX) install(PROGRAMS $ @@ -94,9 +91,9 @@ if(ENABLE_STATIC_BINARY) endif() if(USE_EDITLINE) - target_link_libraries(cvc4-bin ${Editline_LIBRARIES}) - target_link_libraries(main-test ${Editline_LIBRARIES}) - target_include_directories(main PRIVATE ${Editline_INCLUDE_DIRS}) + target_link_libraries(cvc4-bin PUBLIC ${Editline_LIBRARIES}) + target_link_libraries(main-test PUBLIC ${Editline_LIBRARIES}) + target_include_directories(main PUBLIC ${Editline_INCLUDE_DIRS}) endif() #-----------------------------------------------------------------------------# diff --git a/test/api/CMakeLists.txt b/test/api/CMakeLists.txt index 1deea4a87..18c366a45 100644 --- a/test/api/CMakeLists.txt +++ b/test/api/CMakeLists.txt @@ -30,13 +30,12 @@ set(CVC4_API_TEST_FLAGS macro(cvc4_add_api_test name) set(test_bin_dir ${CMAKE_BINARY_DIR}/bin/test/api/) add_executable(${name} ${name}.cpp) - target_link_libraries(${name} main-test) + target_link_libraries(${name} PUBLIC main-test) target_compile_definitions(${name} PRIVATE ${CVC4_API_TEST_FLAGS}) if(USE_CLN) - target_link_libraries(${name} ${CLN_LIBRARIES}) - target_include_directories(${name} PRIVATE $) + target_link_libraries(${name} PRIVATE CLN) endif() - target_link_libraries(${name} GMP) + target_link_libraries(${name} PRIVATE GMP) set_target_properties(${name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${test_bin_dir}) add_test(api/${name} ${test_bin_dir}/${name}) diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt index 7b82f3346..0be0b80e1 100644 --- a/test/unit/CMakeLists.txt +++ b/test/unit/CMakeLists.txt @@ -37,18 +37,17 @@ macro(cvc4_add_unit_test is_white name output_dir) add_executable(${name} ${test_src}) target_compile_definitions(${name} PRIVATE ${CVC4_UNIT_TEST_FLAGS_BLACK}) gtest_add_tests(TARGET ${name}) - target_link_libraries(${name} main-test) - target_link_libraries(${name} GTest::Main) - target_link_libraries(${name} GTest::GTest) + target_link_libraries(${name} PUBLIC main-test) + target_link_libraries(${name} PUBLIC GTest::Main) + target_link_libraries(${name} PUBLIC GTest::GTest) if(USE_CLN) - target_link_libraries(${name} ${CLN_LIBRARIES}) - target_include_directories(${name} PRIVATE $) + target_link_libraries(${name} PUBLIC CLN) endif() if(USE_POLY) - target_link_libraries(${name} Polyxx) + target_link_libraries(${name} PUBLIC Polyxx) endif() - target_link_libraries(${name} GMP) + target_link_libraries(${name} PUBLIC GMP) if(${is_white}) target_compile_options(${name} PRIVATE -fno-access-control) endif() -- 2.30.2