[Polly] Add -std=c99 flag only to C source files
Summary: Adding the flag to C++ source files emits a warning, hence we set the compile flag depending on the file's language. Reviewers: grosser Subscribers: Meinersbur, pollydev, llvm-commits Projects: #polly Differential Revision: http://reviews.llvm.org/D10809 llvm-svn: 240986
This commit is contained in:
parent
6e19ed89a0
commit
acc9ad5991
@ -72,12 +72,17 @@ macro(add_polly_loadable_module name)
|
|||||||
endif()
|
endif()
|
||||||
endmacro(add_polly_loadable_module)
|
endmacro(add_polly_loadable_module)
|
||||||
|
|
||||||
# # Use C99-compatible compile mode for all C source files of a target.
|
# Use C99-compatible compile mode for all C source files of a target.
|
||||||
function(target_enable_c99 _target)
|
function(target_enable_c99 _target)
|
||||||
if(CMAKE_VERSION VERSION_GREATER "3.1")
|
if(CMAKE_VERSION VERSION_GREATER "3.1")
|
||||||
set_target_properties("${_target}" PROPERTIES C_STANDARD 99)
|
set_target_properties("${_target}" PROPERTIES C_STANDARD 99)
|
||||||
elseif(CMAKE_COMPILER_IS_GNUCC)
|
elseif(CMAKE_COMPILER_IS_GNUCC)
|
||||||
get_target_property(_sources "${_target}" SOURCES)
|
get_target_property(_sources "${_target}" SOURCES)
|
||||||
set_source_files_properties(${_sources} COMPILE_FLAGS "-std=gnu99")
|
foreach(_file IN LISTS _sources)
|
||||||
|
get_source_file_property(_lang "${_file}" LANGUAGE)
|
||||||
|
if(_lang STREQUAL "C")
|
||||||
|
set_source_files_properties(${_file} COMPILE_FLAGS "-std=gnu99")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user