From 7c4e5533fb95574034de860105059996b5372013 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 13 Oct 2015 10:16:22 -0500 Subject: [svn-r28053] Change file generation from build time to cmake time. --- src/CMakeLists.txt | 54 +++++++----------------------------------------------- 1 file changed, 7 insertions(+), 47 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ef3e760..4ebcb5e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -780,37 +780,17 @@ set (H5_GENERATED_HEADERS option (HDF5_GENERATE_HEADERS "Rebuild Generated Files" ON) mark_as_advanced (HDF5_GENERATE_HEADERS) if (HDF5_GENERATE_HEADERS) + set_source_files_properties(${H5_GENERATED_HEADERS} PROPERTIES GENERATED TRUE) find_package (Perl) if (PERL_FOUND) - add_custom_command ( - OUTPUT ${HDF5_SRC_DIR}/H5Edefin.h ${HDF5_SRC_DIR}/H5Einit.h ${HDF5_SRC_DIR}/H5Epubgen.h ${HDF5_SRC_DIR}/H5Eterm.h - PRE_BUILD - COMMAND ${PERL_EXECUTABLE} - ARGS ${HDF5_SOURCE_DIR}/bin/make_err ${HDF5_SRC_DIR}/H5err.txt - DEPENDS ${HDF5_SRC_DIR}/H5err.txt - COMMENT " Creating err header" + execute_process ( + COMMAND ${PERL_EXECUTABLE} ${HDF5_SOURCE_DIR}/bin/make_err ${HDF5_SRC_DIR}/H5err.txt ) - - add_custom_command ( - OUTPUT ${HDF5_SRC_DIR}/H5version.h - PRE_BUILD - COMMAND ${PERL_EXECUTABLE} - ARGS ${HDF5_SOURCE_DIR}/bin/make_vers ${HDF5_SRC_DIR}/H5vers.txt - DEPENDS ${HDF5_SRC_DIR}/H5vers.txt - COMMENT " Creating API version macro" + execute_process ( + COMMAND ${PERL_EXECUTABLE} ${HDF5_SOURCE_DIR}/bin/make_vers ${HDF5_SRC_DIR}/H5vers.txt ) - - add_custom_command ( - OUTPUT ${HDF5_SRC_DIR}/H5overflow.h - PRE_BUILD - COMMAND ${PERL_EXECUTABLE} - ARGS ${HDF5_SOURCE_DIR}/bin/make_overflow ${HDF5_SRC_DIR}/H5overflow.txt - DEPENDS ${HDF5_SRC_DIR}/H5overflow.txt - COMMENT " Creating Assignment overflow macro" - ) - - add_custom_target(run_perl_scripts ALL - DEPENDS ${HDF5_SRC_DIR}/H5Edefin.h ${HDF5_SRC_DIR}/H5Einit.h ${HDF5_SRC_DIR}/H5Epubgen.h ${HDF5_SRC_DIR}/H5Eterm.h ${HDF5_SRC_DIR}/H5version.h ${HDF5_SRC_DIR}/H5overflow.h + execute_process ( + COMMAND ${PERL_EXECUTABLE} ${HDF5_SOURCE_DIR}/bin/make_overflow ${HDF5_SRC_DIR}/H5overflow.txt ) else (PERL_FOUND) message (STATUS "Cannot generate headers - perl not found") @@ -826,11 +806,6 @@ TARGET_C_PROPERTIES (H5detect STATIC " " " ") if (MSVC OR MINGW) target_link_libraries (H5detect "ws2_32.lib") endif (MSVC OR MINGW) -if (HDF5_GENERATE_HEADERS) - add_dependencies(H5detect run_perl_scripts) -else (HDF5_GENERATE_HEADERS) - add_dependencies(H5detect "${H5_GENERATED_HEADERS}") -endif (HDF5_GENERATE_HEADERS) set (CMD $) add_custom_command ( @@ -845,11 +820,6 @@ TARGET_C_PROPERTIES (H5make_libsettings STATIC " " " ") if (MSVC OR MINGW) target_link_libraries (H5make_libsettings "ws2_32.lib") endif (MSVC OR MINGW) -if (HDF5_GENERATE_HEADERS) - add_dependencies(H5make_libsettings run_perl_scripts) -else (HDF5_GENERATE_HEADERS) - add_dependencies(H5make_libsettings "${H5_GENERATED_HEADERS}") -endif (HDF5_GENERATE_HEADERS) set (CMD $) add_custom_command ( @@ -881,11 +851,6 @@ set_target_properties (${HDF5_LIB_TARGET} PROPERTIES FOLDER libraries INTERFACE_INCLUDE_DIRECTORIES "$/include>" ) -if (HDF5_GENERATE_HEADERS) - add_dependencies(${HDF5_LIB_TARGET} run_perl_scripts) -else (HDF5_GENERATE_HEADERS) - add_dependencies(${HDF5_LIB_TARGET} "${HDF5_SRC_DIR}/H5Edefin.h;${HDF5_SRC_DIR}/H5Einit.h;${HDF5_SRC_DIR}/H5Epubgen.h;${HDF5_SRC_DIR}/H5Eterm.h") -endif (HDF5_GENERATE_HEADERS) option (HDF5_ENABLE_DEBUG_APIS "Turn on debugging in all packages" OFF) if (HDF5_ENABLE_DEBUG_APIS) @@ -914,11 +879,6 @@ if (BUILD_SHARED_LIBS) INTERFACE_INCLUDE_DIRECTORIES "$/include>" INTERFACE_COMPILE_DEFINITIONS H5_BUILT_AS_DYNAMIC_LIB=1 ) - if (HDF5_GENERATE_HEADERS) - add_dependencies(${HDF5_LIBSH_TARGET} run_perl_scripts) - else (HDF5_GENERATE_HEADERS) - add_dependencies(${HDF5_LIBSH_TARGET} "${HDF5_SRC_DIR}/H5Edefin.h;${HDF5_SRC_DIR}/H5Einit.h;${HDF5_SRC_DIR}/H5Epubgen.h;${HDF5_SRC_DIR}/H5Eterm.h") - endif (HDF5_GENERATE_HEADERS) if (HDF5_ENABLE_THREADSAFE) set_property (TARGET ${HDF5_LIBSH_TARGET} APPEND PROPERTY COMPILE_DEFINITIONS -- cgit v0.12