Skip to content

Commit

Permalink
add option to install against installed clasp target
Browse files Browse the repository at this point in the history
  • Loading branch information
rkaminsk committed May 4, 2022
1 parent 13f305a commit c489fd3
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ libclingo.")
option(CLINGO_INSTALL_LIB
"Advanced option to force installation of static libraries."
OFF)
option(CLINGO_USE_LOCAL_CLASP
"Advanced option to build against bundled clasp or installed clasp target."
ON)


# Python configuration
set(CLINGO_BUILD_WITH_PYTHON "auto" CACHE STRING
Expand Down Expand Up @@ -232,20 +236,24 @@ endif()

enable_testing()

# NOTE: assumes that submodule has been initialized
set(CLASP_BUILD_APP ${CLINGO_BUILD_APPS} CACHE BOOL "")
if (CLINGO_USE_LIB)
set(clingo_library_targets)
add_library(libclingo INTERFACE IMPORTED)
set_property(TARGET libclingo PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${CLINGO_SOURCE_DIR}/libclingo")
set_property(TARGET libclingo PROPERTY INTERFACE_LINK_LIBRARIES "clingo")
else()
set(clingo_library_targets libgringo libpotassco libclasp libreify)
set(CLASP_USE_LOCAL_LIB_POTASSCO ON CACHE BOOL "" FORCE)
if (NOT CLINGO_BUILD_SHARED AND CLINGO_INSTALL_LIB)
set(CLASP_INSTALL_LIB ${CLINGO_INSTALL_LIB} CACHE BOOL "" FORCE)
if (CLINGO_USE_LOCAL_CLASP)
# NOTE: assumes that submodule has been initialized
set(CLASP_BUILD_APP ${CLINGO_BUILD_APPS} CACHE BOOL "")
set(CLASP_USE_LOCAL_LIB_POTASSCO ON CACHE BOOL "" FORCE)
if (NOT CLINGO_BUILD_SHARED AND CLINGO_INSTALL_LIB)
set(CLASP_INSTALL_LIB ${CLINGO_INSTALL_LIB} CACHE BOOL "" FORCE)
endif()
add_subdirectory(clasp)
else()
find_package(Clasp REQUIRED)
endif()
add_subdirectory(clasp)
add_subdirectory(libreify)
add_subdirectory(libgringo)
add_subdirectory(libclingo)
Expand Down

0 comments on commit c489fd3

Please sign in to comment.