diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a85e025c3..0e6e3cde1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,9 +1,38 @@ +################################################################################ +# API header files +################################################################################ +# This lists the API header files that are scanned by +# some of the build rules to generate some files needed +# by the build +set(Z3_API_HEADER_FILES_TO_SCAN + z3_api.h + z3_ast_containers.h + z3_algebraic.h + z3_polynomial.h + z3_rcf.h + z3_fixedpoint.h + z3_optimization.h + z3_interp.h + z3_fpa.h +) +set(Z3_FULL_PATH_API_HEADER_FILES_TO_SCAN "") +foreach (header_file ${Z3_API_HEADER_FILES_TO_SCAN}) + set(full_path_api_header_file "${CMAKE_CURRENT_SOURCE_DIR}/api/${header_file}") + list(APPEND Z3_FULL_PATH_API_HEADER_FILES_TO_SCAN "${full_path_api_header_file}") + if (NOT EXISTS "${full_path_api_header_file}") + message(FATAL_ERROR "API header file \"${full_path_api_header_file}\" does not exist") + endif() +endforeach() + +################################################################################ +# Traverse directories each adding a Z3 component +################################################################################ # I'm duplicating the order in ``mk_project.py`` for now to help us keep # the build systems in sync. # # The components in these directory explicitly declare their dependencies so # you may be able to re-order some of these directories but an error will be -# raised if you try to declare a component is depedent on another component +# raised if you try to declare a component is dependent on another component # that has not yet been declared. add_subdirectory(util) add_subdirectory(math/polynomial) @@ -138,6 +167,7 @@ install(TARGETS libz3 ARCHIVE DESTINATION "${Z3_INSTALL_LIB_DIR}" PUBLIC_HEADER DESTINATION "${Z3_INSTALL_INCLUDE_DIR}" ) + ################################################################################ # Z3 executable ################################################################################ diff --git a/src/api/CMakeLists.txt b/src/api/CMakeLists.txt index 506b28cb3..b5a111a25 100644 --- a/src/api/CMakeLists.txt +++ b/src/api/CMakeLists.txt @@ -1,14 +1,3 @@ -set(api_header_files_to_scan - z3_api.h - z3_ast_containers.h - z3_algebraic.h - z3_polynomial.h - z3_rcf.h - z3_fixedpoint.h - z3_optimization.h - z3_interp.h - z3_fpa.h -) set(generated_files api_commands.cpp api_log_macros.cpp @@ -23,10 +12,6 @@ foreach (gen_file ${generated_files}) endif() endforeach() -set(full_path_api_header_files_to_scan "") -foreach (header_file ${api_header_files_to_scan}) - list(APPEND full_path_api_header_files_to_scan "${CMAKE_CURRENT_SOURCE_DIR}/${header_file}") -endforeach() set(full_path_generated_files "") foreach (gen_file ${generated_files}) list(APPEND full_path_generated_files "${CMAKE_CURRENT_BINARY_DIR}/${gen_file}") @@ -36,12 +21,12 @@ add_custom_command(OUTPUT ${generated_files} COMMAND "${PYTHON_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/scripts/update_api.py" "${CMAKE_CURRENT_BINARY_DIR}" - ${full_path_api_header_files_to_scan} + ${Z3_FULL_PATH_API_HEADER_FILES_TO_SCAN} DEPENDS "${CMAKE_SOURCE_DIR}/scripts/update_api.py" "${CMAKE_SOURCE_DIR}/scripts/mk_util.py" - ${full_path_api_header_files_to_scan} + ${Z3_FULL_PATH_API_HEADER_FILES_TO_SCAN} COMMENT "Generating ${generated_files}" - USES_TERMINAL + ${ADD_CUSTOM_COMMAND_USES_TERMINAL_ARG} VERBATIM )