mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 13:51:33 -06:00
Most arguments were quoted, but some weren't, causing problems if the arguments contained whitespace. In particular, the _STL_EXTRA_DISABLED_WARNINGS value takes spaces and CMake's NASM support applies all add_definitions lines to NASM. The -D flag is missing quotes, so projects using NASM and setting _STL_EXTRA_DISABLED_WARNINGS break in the Visual Studio generator. Likewise, the -o flag is missing quotes, which means filenames with spaces do not work. (The -U flag is unlikely to need quotes, but include them for consistency.) Extend the existing VSNASM test to cover these cases.
21 lines
689 B
CMake
21 lines
689 B
CMake
cmake_minimum_required(VERSION 2.8.12)
|
|
project(VSNASM C ASM_NASM)
|
|
|
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|
add_definitions(-DTESTx64)
|
|
string(APPEND CMAKE_ASM_NASM_FLAGS " -DTEST2x64")
|
|
else()
|
|
add_definitions(-DTESTi386)
|
|
endif()
|
|
|
|
# Test quoting for definitions with spaces.
|
|
add_definitions("-DEAX_COMMA_SPACE_ZERO=eax, 0")
|
|
|
|
# Test quoting for file names with spaces. The file is generated because CMake
|
|
# itself cannot have files with spaces.
|
|
file(READ bar.asm BAR_ASM_CONTENTS)
|
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/bar baz.asm" "${BAR_ASM_CONTENTS}")
|
|
|
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|
add_executable(VSNASM main.c foo.asm "${CMAKE_CURRENT_BINARY_DIR}/bar baz.asm")
|