summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt3
-rw-r--r--document/src/vespa/document/select/CMakeLists.txt3
-rw-r--r--functions.cmake18
-rw-r--r--logd/src/logd/CMakeLists.txt2
-rw-r--r--searchlib/src/vespa/searchlib/engine/CMakeLists.txt2
-rw-r--r--storageapi/src/vespa/storageapi/mbusprot/CMakeLists.txt2
6 files changed, 30 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 873e4c5fad7..da9cb6da6a4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -160,3 +160,6 @@ __create_module_targets(TARGETS "module")
# Create module targets with name ${MODULE}+test depending on every test target defined within that module
__create_module_targets(TEST_TARGETS "test")
+
+# Create module targets with name ${MODULE}+source depending on every source target defined within that module
+__create_module_targets(SOURCE_TARGETS "source")
diff --git a/document/src/vespa/document/select/CMakeLists.txt b/document/src/vespa/document/select/CMakeLists.txt
index f210e8abdd7..e0adfe2b2d9 100644
--- a/document/src/vespa/document/select/CMakeLists.txt
+++ b/document/src/vespa/document/select/CMakeLists.txt
@@ -13,6 +13,9 @@ FLEX_TARGET(DocSelLexer grammar/lexer.ll
ADD_FLEX_BISON_DEPENDENCY(DocSelLexer DocSelParser)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
+vespa_add_source_target(bisongen_document_select DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/parser.cxx ${CMAKE_CURRENT_BINARY_DIR}/parser.hxx)
+vespa_add_source_target(flexgen_document_select DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/lexer.cxx ${CMAKE_CURRENT_BINARY_DIR}/lexer.hxx)
+
vespa_add_library(document_select OBJECT
SOURCES
bodyfielddetector.cpp
diff --git a/functions.cmake b/functions.cmake
index 43dd2d30853..162cb6852b0 100644
--- a/functions.cmake
+++ b/functions.cmake
@@ -101,6 +101,18 @@ function(vespa_add_target_system_dependency TARGET PACKAGE_NAME)
endif()
endfunction()
+function(vespa_add_source_target TARGET)
+ cmake_parse_arguments(
+ ARG
+ ""
+ ""
+ "DEPENDS"
+ ${ARGN}
+ )
+ add_custom_target(${TARGET} DEPENDS ${ARG_DEPENDS})
+ __add_source_target_to_module(${TARGET})
+endfunction()
+
function(vespa_generate_config TARGET RELATIVE_CONFIG_DEF_PATH)
# Generate config-<name>.cpp and config-<name>.h from <name>.def
# Destination directory is always where generate_config is called (or, in the case of out-of-source builds, in the build-tree parallel)
@@ -134,6 +146,7 @@ function(vespa_generate_config TARGET RELATIVE_CONFIG_DEF_PATH)
OUTPUT ${CONFIG_H_PATH} ${CONFIG_CPP_PATH}
COMMAND java -Dconfig.spec=${CONFIG_DEF_PATH} -Dconfig.dest=${CONFIG_DEST_PARENT_DIR} -Dconfig.lang=cpp -Dconfig.subdir=${CONFIG_DEST_DIRNAME} -Dconfig.dumpTree=false -Xms64m -Xmx64m -jar ${PROJECT_SOURCE_DIR}/configgen/target/configgen.jar
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..
+ COMMENT "Generating cpp config for ${CONFIG_NAME} in ${CMAKE_CURRENT_SOURCE_DIR}"
MAIN_DEPENDENCY ${CONFIG_DEF_PATH}
)
@@ -148,6 +161,7 @@ function(vespa_generate_config TARGET RELATIVE_CONFIG_DEF_PATH)
# Needed to be able to do a #include <config-<name>.h> for this target
# This is used within some unit tests
target_include_directories(${TARGET} PRIVATE ${CONFIG_DEST_DIR})
+ vespa_add_source_target("configgen_${TARGET}_${CONFIG_NAME}" DEPENDS ${CONFIG_H_PATH} ${CONFIG_CPP_PATH})
endfunction()
function(vespa_add_library TARGET)
@@ -497,6 +511,10 @@ function(__add_test_target_to_module TARGET)
set_property(GLOBAL APPEND PROPERTY MODULE_${MODULE_NAME}_TEST_TARGETS ${TARGET})
endfunction()
+function(__add_source_target_to_module TARGET)
+ set_property(GLOBAL APPEND PROPERTY MODULE_${MODULE_NAME}_SOURCE_TARGETS ${TARGET})
+endfunction()
+
macro(__handle_test_targets)
# If this is a test executable, add it to the test target for this module
# If building of unit tests is not specified, exclude this target from the all target
diff --git a/logd/src/logd/CMakeLists.txt b/logd/src/logd/CMakeLists.txt
index 865d810fe0e..92f70ef9102 100644
--- a/logd/src/logd/CMakeLists.txt
+++ b/logd/src/logd/CMakeLists.txt
@@ -6,6 +6,8 @@
find_package(Protobuf REQUIRED)
protobuf_generate_cpp(logd_PROTOBUF_SRCS logd_PROTOBUF_HDRS ../../../logserver/src/protobuf/log_protocol.proto)
+vespa_add_source_target(protobufgen_logd DEPENDS ${logd_PROTOBUF_SRCS} ${logd_PROTOBUF_HDRS})
+
# protoc-generated files emit compiler warnings that we normally treat as errors.
if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
set_source_files_properties(${logd_PROTOBUF_SRCS} PROPERTIES COMPILE_FLAGS "-Wno-array-bounds -Wno-suggest-override")
diff --git a/searchlib/src/vespa/searchlib/engine/CMakeLists.txt b/searchlib/src/vespa/searchlib/engine/CMakeLists.txt
index 21a5b232ae0..082af18d32b 100644
--- a/searchlib/src/vespa/searchlib/engine/CMakeLists.txt
+++ b/searchlib/src/vespa/searchlib/engine/CMakeLists.txt
@@ -3,6 +3,8 @@
find_package(Protobuf REQUIRED)
protobuf_generate_cpp(searchlib_engine_PROTOBUF_SRCS searchlib_engine_PROTOBUF_HDRS ../../../../src/protobuf/search_protocol.proto)
+vespa_add_source_target(protobufgen_searchlib_engine DEPENDS ${searchlib_engine_PROTOBUF_SRCS} ${searchlib_engine_PROTOBUF_HDRS})
+
# protoc-generated files emit compiler warnings that we normally treat as errors.
if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
set_source_files_properties(${searchlib_engine_PROTOBUF_SRCS}
diff --git a/storageapi/src/vespa/storageapi/mbusprot/CMakeLists.txt b/storageapi/src/vespa/storageapi/mbusprot/CMakeLists.txt
index 113a4372068..1b1e224f034 100644
--- a/storageapi/src/vespa/storageapi/mbusprot/CMakeLists.txt
+++ b/storageapi/src/vespa/storageapi/mbusprot/CMakeLists.txt
@@ -7,6 +7,8 @@ PROTOBUF_GENERATE_CPP(storageapi_PROTOBUF_SRCS storageapi_PROTOBUF_HDRS
protobuf/visiting.proto
protobuf/maintenance.proto)
+vespa_add_source_target(protobufgen_storageapi_mbusprot DEPENDS ${storageapi_PROTOBUF_SRCS} ${storageapi_PROTOBUF_HDRS})
+
# protoc-generated files emit compiler warnings that we normally treat as errors.
# Instead of rolling our own compiler plugin we'll pragmatically disable the noise.
if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")