diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2015-10-05 07:17:21 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2015-10-05 07:17:21 (GMT) |
commit | 14d1cc2a4ff8ac93a02e79bd5d4c91e05cfa9fb6 (patch) | |
tree | e10e912fa64f1c3ca2c96780e13cecb7debb27e1 /hl | |
parent | 376f8390b6df7d3250afc1b059bcd899ca0aee51 (diff) | |
download | hdf5-14d1cc2a4ff8ac93a02e79bd5d4c91e05cfa9fb6.zip hdf5-14d1cc2a4ff8ac93a02e79bd5d4c91e05cfa9fb6.tar.gz hdf5-14d1cc2a4ff8ac93a02e79bd5d4c91e05cfa9fb6.tar.bz2 |
[svn-r27953] Merge of CMake files from the trunk.
r27796, 27803, 27808, 27817, 27823, 27831, 27836, 27846, 27858-27874,
27894-27897, 27901, 27903-27933
Not tested. CMake still basically broken in this branch.
Diffstat (limited to 'hl')
-rw-r--r-- | hl/src/CMakeLists.txt | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt index 23943f9..e10e1b0 100644 --- a/hl/src/CMakeLists.txt +++ b/hl/src/CMakeLists.txt @@ -1,6 +1,73 @@ cmake_minimum_required (VERSION 3.1.0) PROJECT (HDF5_HL_SRC) +if (HDF5_GENERATE_HEADERS) + file (MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/genLT") + find_package (BISON) + if (BISON_FOUND) + find_package (FLEX) + if (FLEX_FOUND) + BISON_TARGET (H5LT_PARSER H5LTparse.y ${CMAKE_CURRENT_BINARY_DIR}/genLT/H5LTparse.c COMPILE_FLAGS "-d -pH5LTyy") + if (WIN32) + FLEX_TARGET (H5LT_SCANNER H5LTanalyze.l ${CMAKE_CURRENT_BINARY_DIR}/genLT/H5LTanalyze.c COMPILE_FLAGS "--wincompat --nounistd -PH5LTyy") + else (WIN32) + FLEX_TARGET (H5LT_SCANNER H5LTanalyze.l ${CMAKE_CURRENT_BINARY_DIR}/genLT/H5LTanalyze.c COMPILE_FLAGS "--nounistd -PH5LTyy") + endif (WIN32) + ADD_FLEX_BISON_DEPENDENCY(H5LT_SCANNER H5LT_PARSER) + + if (BISON_H5LT_PARSER_DEFINED AND FLEX_H5LT_SCANNER_DEFINED) + include_directories(${CMAKE_CURRENT_BINARY_DIR}) + + add_custom_command ( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/H5LTparse.c ${CMAKE_CURRENT_BINARY_DIR}/H5LTparse.h + PRE_BUILD + COMMAND "${CMAKE_COMMAND}" + -D "GEN_DIR=genLT" + -D "FILE_PARSE=H5LTparse" + -P "${HDF_RESOURCES_DIR}/HDF5_Process_Flex_Files.cmake" + DEPENDS "${BISON_H5LT_PARSER_OUTPUTS}" + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) + add_custom_command ( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/H5LTanalyze.c + PRE_BUILD + COMMAND "${CMAKE_COMMAND}" + -D "GEN_DIR=genLT" + -D "FILE_ANALYZE=H5LTanalyze.c" + -P "${HDF_RESOURCES_DIR}/HDF5_Process_Flex_Files.cmake" + DEPENDS "${FLEX_H5LT_SCANNER_OUTPUTS}" + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) + add_custom_target (process_gen_H5LT + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/H5LTparse.c ${CMAKE_CURRENT_BINARY_DIR}/H5LTanalyze.c + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) + + set (HL_SRCS + ${CMAKE_CURRENT_BINARY_DIR}/H5LTanalyze.c + ${CMAKE_CURRENT_BINARY_DIR}/H5LTparse.c + ) + set (HL_HEADERS + ${CMAKE_CURRENT_BINARY_DIR}/H5LTparse.h + ) + else (BISON_H5LT_PARSER_DEFINED AND FLEX_H5LT_SCANNER_DEFINED) + message (STATUS "Error during generate of files") + endif (BISON_H5LT_PARSER_DEFINED AND FLEX_H5LT_SCANNER_DEFINED) + else (FLEX_FOUND) + message (STATUS "Cannot generate files - flex not found") + endif (FLEX_FOUND) + else (BISON_FOUND) + message (STATUS "Cannot generate files - bison not found") + endif (BISON_FOUND) +else (HDF5_GENERATE_HEADERS) + set (HL_SRCS + ${HDF5_HL_SRC_SOURCE_DIR}/H5LTanalyze.c + ${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.c + ) + set (HL_HEADERS + ${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.h + ) +endif (HDF5_GENERATE_HEADERS) #----------------------------------------------------------------------------- # List Source files @@ -37,6 +104,11 @@ set_target_properties (${HDF5_HL_LIB_TARGET} PROPERTIES ) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_LIB_TARGET}") set (install_targets ${HDF5_HL_LIB_TARGET}) +if (HDF5_GENERATE_HEADERS) + add_dependencies(${HDF5_HL_LIB_TARGET} process_gen_H5LT) +else (HDF5_GENERATE_HEADERS) + add_dependencies(${HDF5_HL_LIB_TARGET} "${HDF5_HL_SRC_SOURCE_DIR}/H5LTanalyze.c;${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.c") +endif (HDF5_GENERATE_HEADERS) if (BUILD_SHARED_LIBS) add_library (${HDF5_HL_LIBSH_TARGET} SHARED ${HL_SRCS} ${HL_HEADERS}) @@ -51,6 +123,11 @@ if (BUILD_SHARED_LIBS) ) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_LIBSH_TARGET}") set (install_targets ${install_targets} ${HDF5_HL_LIBSH_TARGET}) + if (HDF5_GENERATE_HEADERS) + add_dependencies(${HDF5_HL_LIBSH_TARGET} process_gen_H5LT) + else (HDF5_GENERATE_HEADERS) + add_dependencies(${HDF5_HL_LIBSH_TARGET} "${HDF5_HL_SRC_SOURCE_DIR}/H5LTanalyze.c;${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.c") + endif (HDF5_GENERATE_HEADERS) endif (BUILD_SHARED_LIBS) #----------------------------------------------------------------------------- |