diff options
author | Mathias Preiner <mathias.preiner@gmail.com> | 2019-08-14 10:56:26 -0700 |
---|---|---|
committer | Andrew Reynolds <andrew.j.reynolds@gmail.com> | 2019-08-14 12:56:26 -0500 |
commit | 94af13b18b10d6092981848fbae1b9c35b27b31d (patch) | |
tree | dba5ffd52d36b21ac4f990992b6739bb8099b10c /src | |
parent | 27e2baeab7fde6f2fbb5d34548303777ab7e2e5a (diff) |
cmake: Export CVC4 library interface. (#3179)
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 32 | ||||
-rw-r--r-- | src/parser/CMakeLists.txt | 4 |
2 files changed, 24 insertions, 12 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 30594e269..16feace50 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -737,7 +737,16 @@ add_subdirectory(util) set_source_files_properties(${LIBCVC4_GEN_SRCS} PROPERTIES GENERATED TRUE) add_library(cvc4 ${LIBCVC4_SRCS} ${LIBCVC4_GEN_SRCS}) -install(TARGETS cvc4 DESTINATION lib) +target_include_directories(cvc4 + PUBLIC + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> + $<INSTALL_INTERFACE:include> +) + +install(TARGETS cvc4 + EXPORT cvc4-targets + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) set_target_properties(cvc4 PROPERTIES SOVERSION ${CVC4_SOVERSION}) target_compile_definitions(cvc4 @@ -751,44 +760,45 @@ add_dependencies(cvc4 gen-expr gen-gitinfo gen-options gen-tags gen-theory) # Add library/include dependencies if(ENABLE_VALGRIND) - target_include_directories(cvc4 PUBLIC ${Valgrind_INCLUDE_DIR}) + target_include_directories(cvc4 PRIVATE ${Valgrind_INCLUDE_DIR}) endif() if(USE_ABC) target_link_libraries(cvc4 ${ABC_LIBRARIES}) - target_include_directories(cvc4 PUBLIC ${ABC_INCLUDE_DIR}) + target_include_directories(cvc4 PRIVATE ${ABC_INCLUDE_DIR}) endif() if(USE_CADICAL) target_link_libraries(cvc4 ${CaDiCaL_LIBRARIES}) - target_include_directories(cvc4 PUBLIC ${CaDiCaL_INCLUDE_DIR}) + target_include_directories(cvc4 PRIVATE ${CaDiCaL_INCLUDE_DIR}) endif() if(USE_CLN) target_link_libraries(cvc4 ${CLN_LIBRARIES}) - target_include_directories(cvc4 PUBLIC ${CLN_INCLUDE_DIR}) + target_include_directories(cvc4 PUBLIC $<BUILD_INTERFACE:${CLN_INCLUDE_DIR}>) endif() if(USE_CRYPTOMINISAT) target_link_libraries(cvc4 ${CryptoMiniSat_LIBRARIES}) - target_include_directories(cvc4 PUBLIC ${CryptoMiniSat_INCLUDE_DIR}) + target_include_directories(cvc4 PRIVATE ${CryptoMiniSat_INCLUDE_DIR}) endif() if(USE_DRAT2ER) target_link_libraries(cvc4 ${Drat2Er_LIBRARIES}) - target_include_directories(cvc4 PUBLIC ${Drat2Er_INCLUDE_DIR}) + target_include_directories(cvc4 PRIVATE ${Drat2Er_INCLUDE_DIR}) endif() if(USE_GLPK) target_link_libraries(cvc4 ${GLPK_LIBRARIES}) - target_include_directories(cvc4 PUBLIC ${GLPK_INCLUDE_DIR}) + target_include_directories(cvc4 PRIVATE ${GLPK_INCLUDE_DIR}) endif() if(USE_LFSC) target_link_libraries(cvc4 ${LFSC_LIBRARIES}) - target_include_directories(cvc4 PUBLIC ${LFSC_INCLUDE_DIR}) + target_include_directories(cvc4 PRIVATE ${LFSC_INCLUDE_DIR}) endif() if(USE_SYMFPU) - target_include_directories(cvc4 PUBLIC ${SymFPU_INCLUDE_DIR}) + target_include_directories(cvc4 + PUBLIC $<BUILD_INTERFACE:${SymFPU_INCLUDE_DIR}>) endif() # Note: When linked statically GMP needs to be linked after CLN since CLN # depends on GMP. target_link_libraries(cvc4 ${GMP_LIBRARIES}) -target_include_directories(cvc4 PUBLIC ${GMP_INCLUDE_DIR}) +target_include_directories(cvc4 PUBLIC $<BUILD_INTERFACE:${GMP_INCLUDE_DIR}>) # Add rt library # Note: For glibc < 2.17 we have to additionally link against rt (man clock_gettime). diff --git a/src/parser/CMakeLists.txt b/src/parser/CMakeLists.txt index 8ac8baf1b..96790f834 100644 --- a/src/parser/CMakeLists.txt +++ b/src/parser/CMakeLists.txt @@ -100,7 +100,9 @@ set_target_properties(cvc4parser PROPERTIES SOVERSION ${CVC4_SOVERSION}) target_compile_definitions(cvc4parser PRIVATE -D__BUILDING_CVC4PARSERLIB) target_link_libraries(cvc4parser cvc4 ${ANTLR_LIBRARIES}) target_include_directories(cvc4parser PRIVATE ${ANTLR_INCLUDE_DIR}) -install(TARGETS cvc4parser DESTINATION lib) +install(TARGETS cvc4parser + EXPORT cvc4-targets + DESTINATION lib) # The generated lexer/parser files define some functions as # __declspec(dllexport) via the ANTLR3_API macro, which leads to lots of |