summaryrefslogtreecommitdiff
path: root/infrastructure/cmake/CMakeLists.txt
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2015-12-09 22:44:55 +0000
committerChris Wilson <chris+github@qwirx.com>2015-12-09 22:44:55 +0000
commit94abf43c3f1e389c6a606988deabc16522b4f32e (patch)
treec028ea044667d1dfca8fca3b8bdbc29b676c4d6b /infrastructure/cmake/CMakeLists.txt
parent591bc45582dfa4e1799654cff73915b69ebbcf3d (diff)
Generate protocol files as well, like exception files.
Diffstat (limited to 'infrastructure/cmake/CMakeLists.txt')
-rw-r--r--infrastructure/cmake/CMakeLists.txt22
1 files changed, 22 insertions, 0 deletions
diff --git a/infrastructure/cmake/CMakeLists.txt b/infrastructure/cmake/CMakeLists.txt
index 23623eb2..80c136f1 100644
--- a/infrastructure/cmake/CMakeLists.txt
+++ b/infrastructure/cmake/CMakeLists.txt
@@ -169,6 +169,28 @@ foreach(exception_file ${exception_files})
add_dependencies(${module_name} ${CMAKE_MATCH_2})
endforeach()
+set(protocol_files
+ lib/backupstore/backupprotocol.txt
+ test/basicserver/testprotocol.txt
+)
+
+foreach(protocol_file ${protocol_files})
+ string(REGEX MATCH "(.*)/(.*).txt" valid_protocol_file ${protocol_file})
+ if(NOT valid_protocol_file)
+ message(FATAL_ERROR "invalid protocol file: '${protocol_file}'")
+ endif()
+
+ add_custom_command(OUTPUT "${base_dir}/${CMAKE_MATCH_1}/autogen_${CMAKE_MATCH_2}.cpp"
+ MAIN_DEPENDENCY "${base_dir}/${protocol_file}"
+ COMMAND ${PERL_EXECUTABLE} "${base_dir}/lib/server/makeprotocol.pl" "${CMAKE_MATCH_2}.txt"
+ WORKING_DIRECTORY "${base_dir}/${CMAKE_MATCH_1}")
+ add_custom_target(${CMAKE_MATCH_2}
+ DEPENDS "${base_dir}/${CMAKE_MATCH_1}/autogen_${CMAKE_MATCH_2}.cpp")
+
+ string(REPLACE "/" "_" module_name ${CMAKE_MATCH_1})
+ add_dependencies(${module_name} ${CMAKE_MATCH_2})
+endforeach()
+
#include(ExternalProject)
#ExternalProject_Add(pcre
# PREFIX "../pcre"