Make output list of `mkoptions.py` more accurate (#6572)
authorAndres Noetzli <andres.noetzli@gmail.com>
Wed, 19 May 2021 21:53:27 +0000 (14:53 -0700)
committerGitHub <noreply@github.com>
Wed, 19 May 2021 21:53:27 +0000 (21:53 +0000)
After commit 6dc5b74, cvc5 was always
being almost completely rebuilt, even if there hadn't been any changes
if cvc5 was configured not to produce documentation (the default).
This was because mkoptions.py only produces the
options_generated.rst file when documentation is enabled. However, it
was unconditionally declared to be an output of the script in
CMakeLists.txt. As a result, the options (and thus most of the code
base) were rebuilt every time because the file was missing in builds
without documentation. This commit modifies the output list depending on
the configuration.

src/options/CMakeLists.txt

index 997c6850a8e3938f983d5894a980f99b3642946c..2107865c00f22bf89c523437f89a112169a01e56 100644 (file)
@@ -70,11 +70,20 @@ libcvc5_add_sources(GENERATED options.h options.cpp ${options_gen_cpp_files})
 
 list_prepend(options_toml_files "${CMAKE_CURRENT_LIST_DIR}/" abs_toml_files)
 
+set(options_gen_doc_files "")
+if (BUILD_DOCS)
+  list(
+    APPEND
+      options_gen_doc_files
+      "${CMAKE_BINARY_DIR}/docs/options_generated.rst"
+  )
+endif()
+
 add_custom_command(
     OUTPUT
       options.h options.cpp
       ${options_gen_cpp_files} ${options_gen_h_files}
-      ${CMAKE_BINARY_DIR}/docs/options_generated.rst
+      ${options_gen_doc_files}
     COMMAND
       ${PYTHON_EXECUTABLE}
       ${CMAKE_CURRENT_LIST_DIR}/mkoptions.py