Skip to content

Commit

Permalink
Allow specifying indexing of the main directory and subdirs sepearately
Browse files Browse the repository at this point in the history
Bug: if we disable indexing in a subdir, it is disabled for all subdirs.
  • Loading branch information
JanWielemaker committed Dec 12, 2023
1 parent 5c7fb7c commit c0ebe1d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions packages/cmake/PrologPackage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ endif()
set(v_pl_subdirs) # list of subdirs
set(v_pl_gensubdirs) # list of subdirs (generated files)
set(v_index ON)
set(v_index_subdirs ON)
set(v_test OFF)

add_custom_target(${target})
Expand All @@ -128,8 +129,9 @@ endif()
foreach(arg ${ARGN})
if(arg STREQUAL "MODULE")
set(mode md_module)
elseif(arg STREQUAL "NOINDEX")
elseif(arg STREQUAL "NOINDEX" AND NOT mode STREQUAL after_subdir)
set(v_index OFF)
set(v_index_subdirs OFF)
elseif(arg STREQUAL "TEST_ONLY")
set(v_test ON)
elseif(arg STREQUAL "SHARED")
Expand All @@ -151,7 +153,9 @@ endif()
set(v_pl_subdir ${arg})
set(mode after_subdir)
elseif(mode STREQUAL after_subdir)
if(arg STREQUAL "PL_LIBS")
if(arg STREQUAL "NOINDEX")
set(v_index_subdirs OFF)
elseif(arg STREQUAL "PL_LIBS")
set(v_pl_subdirs ${v_pl_subdirs} "@${v_pl_subdir}")
string(REPLACE "/" "_" subdir_var "v_pl_subdir_${v_pl_subdir}")
set(${subdir_var})
Expand Down Expand Up @@ -224,7 +228,10 @@ endif()
FILES ${${subdir_var}}
DESTINATION ${SWIPL_INSTALL_LIBRARY}/ext/${SWIPL_PKG}/${sd})
add_dependencies(${target} ${src_target})
if(v_index)
if(v_index AND NOT sd)
add_index(ext/${SWIPL_PKG}/${sd} ${${subdir_var}})
endif()
if(v_index_subdirs AND sd)
add_index(ext/${SWIPL_PKG}/${sd} ${${subdir_var}})
endif()
endif()
Expand Down

0 comments on commit c0ebe1d

Please sign in to comment.