Project

General

Profile

Revision 3fd9f1f2 share/FindLustre.cmake

View differences:

share/FindLustre.cmake
82 82
  endif()
83 83

  
84 84
  file(MAKE_DIRECTORY ${LUSTRE_OUTPUT_DIR})
85
  set(GLOBAL_LUSTRE_GENERATED_FILES)
85
  set(GLOBAL_LUSTRE_GENERATED_C_FILES "")
86
  # create list of generated C files in parent scope
87
  set(LUSTRE_GENERATED_C_FILES_${LUS_LIBNAME} "" PARENT_SCOPE)
86 88
  foreach(LFILE IN LISTS LUS_LUS_FILES)
87 89
    get_filename_component(L ${LFILE} NAME_WE)
88
    set(LUSTRE_GENERATED_FILES ${LUSTRE_OUTPUT_DIR}/${L}.h ${LUSTRE_OUTPUT_DIR}/${L}.c)
89
    list(APPEND GLOBAL_LUSTRE_GENERATED_FILES ${LUSTRE_GENERATED_FILES})
90
    get_filename_component(E ${LFILE} EXT)
91
    if ("${E}" STREQUAL ".lus")
92
      set(LUSTRE_GENERATED_FILES ${LUSTRE_OUTPUT_DIR}/${L}.h ${LUSTRE_OUTPUT_DIR}/${L}.c ${LUSTRE_OUTPUT_DIR}/${L}_alloc.h)
93
    elseif("${E}" STREQUAL ".lusi")
94
      set(LUSTRE_GENERATED_FILES ${LUSTRE_OUTPUT_DIR}/${L}.h)
95
    endif()
96
    list(APPEND GLOBAL_LUSTRE_GENERATED_C_FILES ${LUSTRE_GENERATED_FILES})
97
    set(LUSTRE_GENERATED_FILES ${LUSTRE_GENERATED_FILES} ${LUSTRE_OUTPUT_DIR}/${L}.lusic)
90 98
    add_custom_command(
91 99
      OUTPUT ${LUSTRE_GENERATED_FILES}
92 100
      COMMAND ${LUSTRE_COMPILER} ${LUSTRE_NODE_OPT} -d ${LUSTRE_OUTPUT_DIR} ${LFILE}
93 101
      DEPENDS ${LFILE}
94 102
      WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
95
      COMMENT "Compile Lustre source(s): ${LFILE}."
103
      COMMENT "Compile Lustre source(s): ${LFILE} (generates: ${LUSTRE_GENERATED_FILES})."
96 104
      )
97 105
    set_source_files_properties(${LUSTRE_GENERATED_FILES} PROPERTIES GENERATED TRUE)
98 106
  endforeach()
99 107

  
100 108
  include_directories(${LUSTRE_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${LUSTRE_OUTPUT_DIR})
101 109
  add_library(${LUS_LIBNAME} SHARED
102
              ${GLOBAL_LUSTRE_GENERATED_FILES} ${LUS_USER_C_FILES}
103
             )
110
              ${GLOBAL_LUSTRE_GENERATED_C_FILES} ${LUS_USER_C_FILES}
111
              )
112
  set(LUSTRE_GENERATED_C_FILES_${LUS_LIBNAME} "${GLOBAL_LUSTRE_GENERATED_C_FILES}" PARENT_SCOPE)
104 113
  message(STATUS "Lustre: Added rule for building lustre library: ${LUS_LIBNAME}")
105 114
endfunction(Lustre_Compile)
106 115

  

Also available in: Unified diff