From 83cd63d83ea71cb8a04ffc5dd1f9c409b7451df6 Mon Sep 17 00:00:00 2001 From: Mathias Preiner Date: Tue, 14 Aug 2018 17:32:26 -0700 Subject: [PATCH] cmake: Cleanup CMakeLists.txt files, remove SHARED. --- CMakeLists.txt | 3 --- src/CMakeLists.txt | 19 ++++++------------- src/base/CMakeLists.txt | 7 +++++-- src/{ => base}/git_versioninfo.cpp.in | 0 src/compat/CMakeLists.txt | 5 ++--- src/expr/CMakeLists.txt | 4 ++-- src/lib/CMakeLists.txt | 4 ++-- src/main/CMakeLists.txt | 12 +++++------- src/options/CMakeLists.txt | 4 ++-- src/parser/CMakeLists.txt | 7 +++++-- src/parser/cvc/CMakeLists.txt | 6 +++--- src/parser/smt1/CMakeLists.txt | 6 +++--- src/parser/smt2/CMakeLists.txt | 6 +++--- src/parser/tptp/CMakeLists.txt | 6 +++--- src/prop/bvminisat/CMakeLists.txt | 17 ++++++++--------- src/prop/minisat/CMakeLists.txt | 17 ++++++++--------- src/smt_util/CMakeLists.txt | 4 ++-- src/util/CMakeLists.txt | 20 ++++++-------------- 18 files changed, 65 insertions(+), 82 deletions(-) rename src/{ => base}/git_versioninfo.cpp.in (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a3c13085..a0bc529ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -157,10 +157,7 @@ set(CVC4_BUILD_PROFILE_COMPETITION 0) #-----------------------------------------------------------------------------# find_package(PythonInterp REQUIRED) - find_package(ANTLR REQUIRED) -cvc4_link_library(${ANTLR_LIBRARIES}) -include_directories(${ANTLR_INCLUDE_DIR}) find_package(GMP REQUIRED) cvc4_link_library(${GMP_LIBRARIES}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f8c9752f0..a5328843f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,10 +1,4 @@ -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/git_versioninfo.cpp.in - ${CMAKE_CURRENT_BINARY_DIR}/git_versioninfo.cpp -) - set(cvc4_src_files - ${CMAKE_CURRENT_BINARY_DIR}/git_versioninfo.cpp api/cvc4cpp.cpp api/cvc4cpp.h api/cvc4cppkind.h @@ -566,13 +560,12 @@ set(cvc4_gen_src_files # tell cmake that the files are generated. set_source_files_properties(${cvc4_gen_src_files} PROPERTIES GENERATED TRUE) -add_library(cvc4 SHARED ${cvc4_src_files} ${cvc4_gen_src_files}) -set_target_properties(cvc4 - PROPERTIES - COMPILE_DEFINITIONS - __BUILDING_CVC4LIB - __STDC_LIMIT_MACROS - __STDC_FORMAT_MACROS +add_library(cvc4 ${cvc4_src_files} ${cvc4_gen_src_files}) +target_compile_definitions(cvc4 + PRIVATE + -D__BUILDING_CVC4LIB + -D__STDC_LIMIT_MACROS + -D__STDC_FORMAT_MACROS ) add_dependencies(cvc4 gen-theory-files) target_link_libraries(cvc4 diff --git a/src/base/CMakeLists.txt b/src/base/CMakeLists.txt index ea44c4fc3..dc0b7c09c 100644 --- a/src/base/CMakeLists.txt +++ b/src/base/CMakeLists.txt @@ -1,3 +1,5 @@ +configure_file(git_versioninfo.cpp.in git_versioninfo.cpp) + set(base_src_files configuration.cpp configuration.h @@ -15,8 +17,9 @@ set(base_src_files output.h ) -add_library(base SHARED ${base_src_files}) -set_target_properties(base PROPERTIES COMPILE_DEFINITIONS __BUILDING_CVC4LIB) +add_library(base + ${base_src_files} ${CMAKE_CURRENT_BINARY_DIR}/git_versioninfo.cpp) +target_compile_definitions(base PRIVATE -D__BUILDING_CVC4LIB) add_dependencies(base tags_headers) # diff --git a/src/git_versioninfo.cpp.in b/src/base/git_versioninfo.cpp.in similarity index 100% rename from src/git_versioninfo.cpp.in rename to src/base/git_versioninfo.cpp.in diff --git a/src/compat/CMakeLists.txt b/src/compat/CMakeLists.txt index 92b6aabfa..f327de593 100644 --- a/src/compat/CMakeLists.txt +++ b/src/compat/CMakeLists.txt @@ -3,7 +3,6 @@ set(compat_src_files cvc3_compat.h ) -add_library(cvc4compat SHARED ${compat_src_files}) -set_target_properties(cvc4compat - PROPERTIES COMPILE_DEFINITIONS __BUILDING_CVC4COMPATLIB) +add_library(cvc4compat ${compat_src_files}) +target_compile_definitions(cvc4compat PRIVATE -D__BUILDING_CVC4COMPATLIB) target_link_libraries(cvc4compat cvc4) diff --git a/src/expr/CMakeLists.txt b/src/expr/CMakeLists.txt index a2e55f874..dd3d83481 100644 --- a/src/expr/CMakeLists.txt +++ b/src/expr/CMakeLists.txt @@ -60,8 +60,8 @@ set(expr_gen_src_files type_properties.h ) -add_library(expr SHARED ${expr_src_files} ${expr_gen_src_files}) -set_target_properties(expr PROPERTIES COMPILE_DEFINITIONS __BUILDING_CVC4LIB) +add_library(expr ${expr_src_files} ${expr_gen_src_files}) +target_compile_definitions(expr PRIVATE -D__BUILDING_CVC4LIB) # # Generate code for kinds. diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index b56a0bb82..ffebfed82 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -8,5 +8,5 @@ set(replacements_src_files strtok_r.h ) -add_library(replacements SHARED ${replacements_src_files}) -set_target_properties(replacements PROPERTIES COMPILE_DEFINITIONS __BUILDING_CVC4LIB) +add_library(replacements ${replacements_src_files}) +target_compile_definitions(replacements PRIVATE -D__BUILDING_CVC4LIB) diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index 1a586f834..a66ab5a1e 100644 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -5,8 +5,8 @@ set(libmain_src_files util.cpp ) -add_library(main SHARED ${libmain_src_files}) -set_target_properties(main PROPERTIES COMPILE_DEFINITIONS __BUILDING_CVC4DRIVER) +add_library(main ${libmain_src_files}) +target_compile_definitions(main PRIVATE -D__BUILDING_CVC4DRIVER) target_link_libraries(main cvc4 cvc4parser) set(cvc4main_src_files @@ -16,11 +16,9 @@ set(cvc4main_src_files ) add_executable(cvc4-main ${cvc4main_src_files}) -set_target_properties(cvc4-main - PROPERTIES - OUTPUT_NAME cvc4 - COMPILE_DEFINITIONS __BUILDING_CVC4DRIVER) -target_link_libraries(cvc4-main main) #cvc4 cvc4parser replacements) +target_compile_definitions(cvc4-main PRIVATE -D__BUILDING_CVC4DRIVER) +set_target_properties(cvc4-main PROPERTIES OUTPUT_NAME cvc4) +target_link_libraries(cvc4-main main) #set(pcvc4_src_files # main.cpp diff --git a/src/options/CMakeLists.txt b/src/options/CMakeLists.txt index 5fcc22bd9..10511867f 100644 --- a/src/options/CMakeLists.txt +++ b/src/options/CMakeLists.txt @@ -101,5 +101,5 @@ set(options_src_files ufss_mode.h ) -add_library(options SHARED options.cpp ${options_gen_cpp_files} ${options_src_files}) -set_target_properties(options PROPERTIES COMPILE_DEFINITIONS __BUILDING_CVC4LIB) +add_library(options options.cpp ${options_gen_cpp_files} ${options_src_files}) +target_compile_definitions(options PRIVATE -D__BUILDING_CVC4LIB) diff --git a/src/parser/CMakeLists.txt b/src/parser/CMakeLists.txt index 8c0a65fa7..bc8861ea8 100644 --- a/src/parser/CMakeLists.txt +++ b/src/parser/CMakeLists.txt @@ -23,10 +23,13 @@ set(cvc4parser_src_files parser_exception.h ) -add_library(cvc4parser SHARED ${cvc4parser_src_files}) -set_target_properties(cvc4parser PROPERTIES COMPILE_DEFINITIONS __BUILDING_CVC4PARSERLIB) +add_library(cvc4parser ${cvc4parser_src_files}) +target_compile_definitions(cvc4parser PRIVATE -D__BUILDING_CVC4PARSERLIB) target_link_libraries(cvc4parser parsercvc parsersmt1 parsersmt2 parsertptp cvc4) +target_link_libraries(cvc4parser ${ANTLR_LIBRARIES}) +# ANTLR includes required for all subdirectories +include_directories(cvc4parser PRIVATE ${ANTLR_INCLUDE_DIR}) add_subdirectory(cvc) add_subdirectory(smt1) add_subdirectory(smt2) diff --git a/src/parser/cvc/CMakeLists.txt b/src/parser/cvc/CMakeLists.txt index 8f27cbb25..ab88ffe1b 100644 --- a/src/parser/cvc/CMakeLists.txt +++ b/src/parser/cvc/CMakeLists.txt @@ -19,7 +19,7 @@ add_custom_command( Cvc.g ) -add_library(parsercvc SHARED ${parser_cvc_src_files} ${parser_cvc_gen_src_files}) -set_target_properties(parsercvc PROPERTIES COMPILE_DEFINITIONS __BUILDING_CVC4PARSERLIB) +add_library(parsercvc ${parser_cvc_src_files} ${parser_cvc_gen_src_files}) +target_compile_definitions(parsercvc PRIVATE -D__BUILDING_CVC4PARSERLIB) set_source_files_properties(${parser_cvc_gen_src_files} PROPERTIES LANGUAGE CXX) -add_dependencies(parsercvc expr) +target_link_libraries(parsercvc expr) diff --git a/src/parser/smt1/CMakeLists.txt b/src/parser/smt1/CMakeLists.txt index 89f440e8e..2dd0bfd9b 100644 --- a/src/parser/smt1/CMakeLists.txt +++ b/src/parser/smt1/CMakeLists.txt @@ -21,7 +21,7 @@ add_custom_command( Smt1.g ) -add_library(parsersmt1 SHARED ${parser_smt1_src_files} ${parser_smt1_gen_src_files}) -set_target_properties(parsersmt1 PROPERTIES COMPILE_DEFINITIONS __BUILDING_CVC4PARSERLIB) +add_library(parsersmt1 ${parser_smt1_src_files} ${parser_smt1_gen_src_files}) +target_compile_definitions(parsersmt1 PRIVATE -D__BUILDING_CVC4PARSERLIB) set_source_files_properties(${parser_smt1_gen_src_files} PROPERTIES LANGUAGE CXX) -add_dependencies(parsersmt1 expr) +target_link_libraries(parsersmt1 expr) diff --git a/src/parser/smt2/CMakeLists.txt b/src/parser/smt2/CMakeLists.txt index b046a6767..90cc391b0 100644 --- a/src/parser/smt2/CMakeLists.txt +++ b/src/parser/smt2/CMakeLists.txt @@ -23,7 +23,7 @@ add_custom_command( Smt2.g ) -add_library(parsersmt2 SHARED ${parser_smt2_src_files} ${parser_smt2_gen_src_files}) -set_target_properties(parsersmt2 PROPERTIES COMPILE_DEFINITIONS __BUILDING_CVC4PARSERLIB) +add_library(parsersmt2 ${parser_smt2_src_files} ${parser_smt2_gen_src_files}) +target_compile_definitions(parsersmt2 PRIVATE -D__BUILDING_CVC4PARSERLIB) set_source_files_properties(${parser_smt2_gen_src_files} PROPERTIES LANGUAGE CXX) -add_dependencies(parsersmt2 expr) +target_link_libraries(parsersmt2 expr) diff --git a/src/parser/tptp/CMakeLists.txt b/src/parser/tptp/CMakeLists.txt index 22593e7b2..aadd47a2a 100644 --- a/src/parser/tptp/CMakeLists.txt +++ b/src/parser/tptp/CMakeLists.txt @@ -21,7 +21,7 @@ add_custom_command( Tptp.g ) -add_library(parsertptp SHARED ${parser_tptp_src_files} ${parser_tptp_gen_src_files}) -set_target_properties(parsertptp PROPERTIES COMPILE_DEFINITIONS __BUILDING_CVC4PARSERLIB) +add_library(parsertptp ${parser_tptp_src_files} ${parser_tptp_gen_src_files}) +target_compile_definitions(parsertptp PRIVATE -D__BUILDING_CVC4PARSERLIB) set_source_files_properties(${parser_tptp_gen_src_files} PROPERTIES LANGUAGE CXX) -add_dependencies(parsertptp expr) +target_link_libraries(parsertptp expr) diff --git a/src/prop/bvminisat/CMakeLists.txt b/src/prop/bvminisat/CMakeLists.txt index f55d74c48..3a5d4dba2 100644 --- a/src/prop/bvminisat/CMakeLists.txt +++ b/src/prop/bvminisat/CMakeLists.txt @@ -19,13 +19,12 @@ set(bvminisat_src_files utils/Options.h ) -include_directories(.) -add_library(bvminisat SHARED ${bvminisat_src_files}) -set_target_properties(bvminisat - PROPERTIES - COMPILE_DEFINITIONS - __BUILDING_CVC4LIB - __STDC_LIMIT_MACROS - __STDC_FORMAT_MACROS +add_library(bvminisat ${bvminisat_src_files}) +target_include_directories(bvminisat PRIVATE .) +target_compile_definitions(bvminisat + PRIVATE + -D__BUILDING_CVC4LIB + -D__STDC_LIMIT_MACROS + -D__STDC_FORMAT_MACROS ) -add_dependencies(bvminisat expr) +target_link_libraries(bvminisat expr) diff --git a/src/prop/minisat/CMakeLists.txt b/src/prop/minisat/CMakeLists.txt index 137b15766..fee8233bd 100644 --- a/src/prop/minisat/CMakeLists.txt +++ b/src/prop/minisat/CMakeLists.txt @@ -19,13 +19,12 @@ set(minisat_src_files utils/Options.h ) -include_directories(.) -add_library(minisat SHARED ${minisat_src_files}) -set_target_properties(minisat - PROPERTIES - COMPILE_DEFINITIONS - __BUILDING_CVC4LIB - __STDC_LIMIT_MACROS - __STDC_FORMAT_MACROS +add_library(minisat ${minisat_src_files}) +target_include_directories(minisat PRIVATE .) +target_compile_definitions(minisat + PRIVATE + -D__BUILDING_CVC4LIB + -D__STDC_LIMIT_MACROS + -D__STDC_FORMAT_MACROS ) -add_dependencies(minisat expr) +target_link_libraries(minisat expr) diff --git a/src/smt_util/CMakeLists.txt b/src/smt_util/CMakeLists.txt index 9934db350..f0c61de3b 100644 --- a/src/smt_util/CMakeLists.txt +++ b/src/smt_util/CMakeLists.txt @@ -10,6 +10,6 @@ set(smtutil_src_files node_visitor.h ) -add_library(smtutil SHARED ${smtutil_src_files}) -set_target_properties(smtutil PROPERTIES COMPILE_DEFINITIONS __BUILDING_CVC4LIB) +add_library(smtutil ${smtutil_src_files}) +target_compile_definitions(smtutil PRIVATE -D__BUILDING_CVC4LIB) target_link_libraries(smtutil expr) diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt index 54c921371..724a1ae5a 100644 --- a/src/util/CMakeLists.txt +++ b/src/util/CMakeLists.txt @@ -1,14 +1,6 @@ -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/floatingpoint.h.in - ${CMAKE_CURRENT_BINARY_DIR}/floatingpoint.h) - -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/rational.h.in - ${CMAKE_CURRENT_BINARY_DIR}/rational.h) - -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/integer.h.in - ${CMAKE_CURRENT_BINARY_DIR}/integer.h) +configure_file(floatingpoint.h.in floatingpoint.h) +configure_file(rational.h.in rational.h) +configure_file(integer.h.in integer.h) set(util_src_files abstract_value.cpp @@ -68,6 +60,6 @@ if(CVC4_USE_GMP_IMP) list(APPEND util_src_files rational_gmp_imp.cpp integer_gmp_imp.cpp) endif() -add_library(util SHARED ${util_src_files}) -set_target_properties(util PROPERTIES COMPILE_DEFINITIONS __BUILDING_CVC4LIB) -add_dependencies(util options) +add_library(util ${util_src_files}) +target_compile_definitions(util PRIVATE -D__BUILDING_CVC4LIB) +target_link_libraries(util options) -- 2.30.2