Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
VS: Properly quote arguments in nasm.xml
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.
- Loading branch information
Showing
5 changed files
with
30 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,20 @@ | ||
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) | ||
add_executable(VSNASM main.c foo.asm "${CMAKE_CURRENT_BINARY_DIR}/bar baz.asm") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
section .text | ||
%ifdef TEST2x64 | ||
global bar | ||
%else | ||
global _bar | ||
%endif | ||
%ifdef TESTx64 | ||
bar: | ||
%else | ||
_bar: | ||
%endif | ||
mov EAX_COMMA_SPACE_ZERO | ||
ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,5 @@ foo: | |
%else | ||
_foo: | ||
%endif | ||
mov eax, 0 | ||
mov EAX_COMMA_SPACE_ZERO | ||
ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
extern int foo(void); | ||
extern int bar(void); | ||
int main(void) | ||
{ | ||
return foo(); | ||
return foo() + bar(); | ||
} |