Skip to content

Commit

Permalink
BUILD: Simplify forced building of the library indices.
Browse files Browse the repository at this point in the history
  • Loading branch information
JanWielemaker committed Nov 5, 2023
1 parent 4ef13af commit 71caaeb
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions cmake/LibIndex.cmake
Original file line number Diff line number Diff line change
@@ -1,29 +1,20 @@
include(QLF)

# Rebuild all library indexes. First build is always ok, but as we do
# not know all dependencies for each library index and these may change,
# we wish to re-run these on every build run. We do this by setting the
# OUTPUT to a dummy file that is not really created.

function(library_index)

foreach(dir ${ARGN})
string(REGEX REPLACE "/" "_" dirtarget ${dir})
set(target library_index_${dirtarget})

if(NOT TARGET ${target})
add_custom_target(
${target}_always ALL
DEPENDS ${SWIPL_BUILD_HOME}/${dir}/__INDEX.pl)

if(CMAKE_GENERATOR STREQUAL "Unix Makefiles")
set(out ${SWIPL_BUILD_HOME}/${dir}/__INDEX.pl)
set(by)
else()
set(by ${SWIPL_BUILD_HOME}/${dir}/__INDEX.pl)
set(out)
endif()

add_swipl_target(
${target}
OUTPUT ${SWIPL_BUILD_HOME}/${dir}/INDEX.pl ${out}
BYPRODUCTS ${by}
QUIET
OUTPUT ${SWIPL_BUILD_HOME}/${dir}/__INDEX.pl
COMMAND "make_library_index('${SWIPL_BUILD_HOME}/${dir}')"
COMMENT "Build home/${dir}/INDEX.pl")
add_dependencies(library_index ${target})
Expand Down

0 comments on commit 71caaeb

Please sign in to comment.