Fix Assembler test to parse C flags string before using

Commit 1f6c6b1c (use CMAKE_C_FLAGS when generating the assembler file,
2011-03-03) added use of CMAKE_C_FLAGS to the assembler generation step.
However, this variable is meant for direct substitution into a shell
command line so we need to parse it to separate the arguments first.
This commit is contained in:
Brad King 2011-03-04 08:59:56 -05:00
parent 4139a734fa
commit 1dafa7498f
1 changed files with 3 additions and 1 deletions

View File

@ -7,7 +7,9 @@ set(SRCS)
# and also generate assembler files from C: # and also generate assembler files from C:
if("${CMAKE_GENERATOR}" MATCHES "Makefile") if("${CMAKE_GENERATOR}" MATCHES "Makefile")
if(("${CMAKE_C_COMPILER_ID}" MATCHES "^(GNU|HP|SunPro|XL)$") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Intel" AND UNIX)) if(("${CMAKE_C_COMPILER_ID}" MATCHES "^(GNU|HP|SunPro|XL)$") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Intel" AND UNIX))
execute_process(COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAGS} -S "${CMAKE_CURRENT_SOURCE_DIR}/main.c" -o "${CMAKE_CURRENT_BINARY_DIR}/main.s") set(C_FLAGS "${CMAKE_C_FLAGS}")
separate_arguments(C_FLAGS)
execute_process(COMMAND ${CMAKE_C_COMPILER} ${C_FLAGS} -S "${CMAKE_CURRENT_SOURCE_DIR}/main.c" -o "${CMAKE_CURRENT_BINARY_DIR}/main.s")
set(SRCS "${CMAKE_CURRENT_BINARY_DIR}/main.s") set(SRCS "${CMAKE_CURRENT_BINARY_DIR}/main.s")
endif(("${CMAKE_C_COMPILER_ID}" MATCHES "^(GNU|HP|SunPro|XL)$") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Intel" AND UNIX)) endif(("${CMAKE_C_COMPILER_ID}" MATCHES "^(GNU|HP|SunPro|XL)$") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Intel" AND UNIX))
endif("${CMAKE_GENERATOR}" MATCHES "Makefile") endif("${CMAKE_GENERATOR}" MATCHES "Makefile")