cmake: Build object libraries for base and context. (#6374)
authorMathias Preiner <mathias.preiner@gmail.com>
Fri, 16 Apr 2021 06:55:25 +0000 (23:55 -0700)
committerGitHub <noreply@github.com>
Fri, 16 Apr 2021 06:55:25 +0000 (08:55 +0200)
cmake complains that the static base and context libraries are not
exported as install targets. Since we do not want to install these
libraries we'll build object libraries instead.

src/CMakeLists.txt
src/base/CMakeLists.txt
src/context/CMakeLists.txt

index e060ae43f402440b3ac4e28e86b79380af0c8d3f..81105e817e5d8c663c302fafb0c409030b6e01bb 100644 (file)
@@ -1091,26 +1091,18 @@ endif()
 add_subdirectory(theory)
 add_subdirectory(util)
 
-#-----------------------------------------------------------------------------#
-# Build support library from base and context that can be used in the main
-# library as well as the parser library.
-
-add_library(cvc4support INTERFACE)
-target_link_libraries(cvc4support INTERFACE cvc4base)
-target_link_libraries(cvc4support INTERFACE cvc4context)
-
 #-----------------------------------------------------------------------------#
 # All sources for libcvc4 are now collected in LIBCVC4_SRCS and (if generated)
 # LIBCVC4_GEN_SRCS (via libcvc4_add_sources). We can now build libcvc4.
 
 set_source_files_properties(${LIBCVC4_GEN_SRCS} PROPERTIES GENERATED TRUE)
-add_library(cvc4 ${LIBCVC4_SRCS} ${LIBCVC4_GEN_SRCS})
+add_library(cvc4 ${LIBCVC4_SRCS} ${LIBCVC4_GEN_SRCS}
+  $<TARGET_OBJECTS:cvc4base> $<TARGET_OBJECTS:cvc4context>)
 target_include_directories(cvc4
   PUBLIC
     $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
     $<INSTALL_INTERFACE:include>
 )
-target_link_libraries(cvc4 PRIVATE cvc4support)
 
 include(GenerateExportHeader)
 generate_export_header(cvc4)
index 684660f78e0dc059cb87134ced298d2c5f1cd472..5da1216d0a5c22a476325f6e2117e1ce38b34d45 100644 (file)
@@ -79,7 +79,7 @@ set_source_files_properties(
   PROPERTIES GENERATED TRUE
 )
 
-add_library(cvc4base STATIC ${LIBBASE_SOURCES})
+add_library(cvc4base OBJECT ${LIBBASE_SOURCES})
 if(ENABLE_SHARED)
   set_target_properties(cvc4base PROPERTIES POSITION_INDEPENDENT_CODE ON)
 endif()
index 8800f1a23636556bc665df37c5c13b5c0fa7fd82..fb1d25111b0da4fdc19b710720387e258fcd1928 100644 (file)
@@ -34,7 +34,7 @@ set(LIBCONTEXT_SOURCES
   context_mm.h
 )
 
-add_library(cvc4context STATIC ${LIBCONTEXT_SOURCES})
+add_library(cvc4context OBJECT ${LIBCONTEXT_SOURCES})
 if(ENABLE_SHARED)
   set_target_properties(cvc4context PROPERTIES POSITION_INDEPENDENT_CODE ON)
 endif()