Project

General

Profile

Revision a1daa793 share/FindLustre.cmake

View differences:

share/FindLustre.cmake
15 15
# The module defines some functions:
16 16
#   Lustre_Compile([NODE <Lustre Main Node>]
17 17
#                  LUS_FILES <Lustre files>
18
#                  [USER_C_FILES <C files>])
18
#                  [USER_C_FILES <C files>]
19
#                  [VERBOSE <level>]
20
#                  LIBNAME <libraryName>)
21
#
22
# When used the Lustre_Compile macro define the variable
23
# LUSTRE_GENERATED_C_FILES_<libraryName> in the parent scope
24
# so that the caller can get (if needed) the list of Lustre generated files.
25
# The VERBOSE level is a numeric value passed directly to the -verbose
26
# command line option of the lustre compiler
19 27
#
20 28

  
21 29
if(LUSTRE_PATH_HINT)
......
65 73
include(CMakeParseArguments)
66 74
function(Lustre_Compile)
67 75
  set(options "")
68
  set(oneValueArgs NODE LIBNAME)
76
  set(oneValueArgs NODE LIBNAME VERBOSE)
69 77
  set(multiValueArgs LUS_FILES USER_C_FILES)
70 78
  cmake_parse_arguments(LUS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
71 79

  
......
81 89
    set(LUSTRE_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/lus_${LUS_LIBNAME}")
82 90
  endif()
83 91

  
92
  if (LUS_VERBOSE)
93
    set(LUSTRE_VERBOSE_OPT "-verbose ${LUS_VERBOSE}")
94
  else()
95
    # the default is to be quiet.
96
    set(LUSTRE_VERBOSE_OPT "-verbose;0")
97
  endif()
98

  
84 99
  file(MAKE_DIRECTORY ${LUSTRE_OUTPUT_DIR})
85 100
  set(GLOBAL_LUSTRE_GENERATED_C_FILES "")
86 101
  # create list of generated C files in parent scope
......
97 112
    set(LUSTRE_GENERATED_FILES ${LUSTRE_GENERATED_FILES} ${LUSTRE_OUTPUT_DIR}/${L}.lusic)
98 113
    add_custom_command(
99 114
      OUTPUT ${LUSTRE_GENERATED_FILES}
100
      COMMAND ${LUSTRE_COMPILER} ${LUSTRE_NODE_OPT} -d ${LUSTRE_OUTPUT_DIR} ${LFILE}
115
      COMMAND ${LUSTRE_COMPILER} ${LUSTRE_VERBOSE_OPT} ${LUSTRE_NODE_OPT} -d ${LUSTRE_OUTPUT_DIR} ${LFILE}
101 116
      DEPENDS ${LFILE}
102 117
      WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
103 118
      COMMENT "Compile Lustre source(s): ${LFILE} (generates: ${LUSTRE_GENERATED_FILES})."
......
109 124
  add_library(${LUS_LIBNAME} SHARED
110 125
              ${GLOBAL_LUSTRE_GENERATED_C_FILES} ${LUS_USER_C_FILES}
111 126
              )
127
  set_target_properties(${LUS_LIBNAME} PROPERTIES COMPILE_FLAGS "-std=c99")
112 128
  set(LUSTRE_GENERATED_C_FILES_${LUS_LIBNAME} "${GLOBAL_LUSTRE_GENERATED_C_FILES}" PARENT_SCOPE)
113 129
  message(STATUS "Lustre: Added rule for building lustre library: ${LUS_LIBNAME}")
114 130
endfunction(Lustre_Compile)

Also available in: Unified diff