From 106a36c22b0a477ccb77191c50a2aadd8afa7f51 Mon Sep 17 00:00:00 2001 From: Alexey Sokolov Date: Wed, 21 Dec 2016 08:59:10 +0000 Subject: [PATCH] Rerun SWIG in CMake build when headers change. --- modules/modperl/CMakeLists.txt | 3 +++ modules/modpython/CMakeLists.txt | 3 +++ 2 files changed, 6 insertions(+) diff --git a/modules/modperl/CMakeLists.txt b/modules/modperl/CMakeLists.txt index 7d14ca38..f08401a6 100644 --- a/modules/modperl/CMakeLists.txt +++ b/modules/modperl/CMakeLists.txt @@ -54,6 +54,7 @@ if(SWIG_FOUND) -o "${CMAKE_CURRENT_BINARY_DIR}/modperl_biglib.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/modperl.i" DEPENDS "modperl.i" + IMPLICIT_DEPENDS CXX "${CMAKE_CURRENT_SOURCE_DIR}/modperl.i" VERBATIM) else() add_custom_command( @@ -64,12 +65,14 @@ else() endif() add_custom_target(modperl_functions DEPENDS "perlfunctions.cpp") add_custom_target(modperl_swigruntime DEPENDS "swigperlrun.h") +add_custom_target(modperl_swig DEPENDS "modperl_biglib.cpp" "ZNC.pm") execute_process(COMMAND "${PERL_EXECUTABLE}" -MConfig "-eprint $Config::Config{dlext}" OUTPUT_VARIABLE perl_ext) znc_add_library(modperl_lib MODULE modperl_biglib.cpp) +add_dependencies(modperl_lib modperl_swig) target_include_directories(modperl_lib PRIVATE "${PROJECT_BINARY_DIR}/include" "${PROJECT_SOURCE_DIR}/include" diff --git a/modules/modpython/CMakeLists.txt b/modules/modpython/CMakeLists.txt index 7901ec20..279fe491 100644 --- a/modules/modpython/CMakeLists.txt +++ b/modules/modpython/CMakeLists.txt @@ -50,6 +50,7 @@ if(SWIG_FOUND) -o "${CMAKE_CURRENT_BINARY_DIR}/modpython_biglib.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/modpython.i" DEPENDS "modpython.i" + IMPLICIT_DEPENDS CXX "${CMAKE_CURRENT_SOURCE_DIR}/modpython.i" VERBATIM) else() add_custom_command( @@ -60,8 +61,10 @@ else() endif() add_custom_target(modpython_functions DEPENDS "pyfunctions.cpp") add_custom_target(modpython_swigruntime DEPENDS "swigpyrun.h") +add_custom_target(modpython_swig DEPENDS "modpython_biglib.cpp" "znc_core.py") znc_add_library(modpython_lib MODULE modpython_biglib.cpp) +add_dependencies(modpython_lib modpython_swig) target_include_directories(modpython_lib PRIVATE "${PROJECT_BINARY_DIR}/include" "${PROJECT_SOURCE_DIR}/include"