summaryrefslogtreecommitdiffstats
path: root/Tests/NasmOnly
diff options
context:
space:
mode:
authorVito Gamberini <vito@gamberini.email>2024-03-04 16:42:46 (GMT)
committerVito Gamberini <vito@gamberini.email>2024-03-04 18:09:58 (GMT)
commit7cf45c9e6a7633cb231dfa07d8e7346200242af0 (patch)
tree013f5b71b9a2269461cb189d219a3da6d321d6ea /Tests/NasmOnly
parent47bc42b5ac66ed4a144ad7822c12cd9a3f34c333 (diff)
downloadCMake-7cf45c9e6a7633cb231dfa07d8e7346200242af0.zip
CMake-7cf45c9e6a7633cb231dfa07d8e7346200242af0.tar.gz
CMake-7cf45c9e6a7633cb231dfa07d8e7346200242af0.tar.bz2
ASM_NASM: Improve support for standalone usage
* Add tests for standalone NASM usage * Change generic ASM_NASM executable linker to <CMAKE_LINKER> * Use CMAKE_SYSTEM_PROCESSOR to determine output format when used without a C/CXX compiler
Diffstat (limited to 'Tests/NasmOnly')
-rw-r--r--Tests/NasmOnly/CMakeLists.txt7
-rw-r--r--Tests/NasmOnly/libnasm1.nasm6
-rw-r--r--Tests/NasmOnly/nasmonly.nasm19
3 files changed, 32 insertions, 0 deletions
diff --git a/Tests/NasmOnly/CMakeLists.txt b/Tests/NasmOnly/CMakeLists.txt
new file mode 100644
index 0000000..e4190c2
--- /dev/null
+++ b/Tests/NasmOnly/CMakeLists.txt
@@ -0,0 +1,7 @@
+cmake_minimum_required(VERSION 3.28)
+
+project(NasmOnly LANGUAGES ASM_NASM)
+
+add_library(testnasm1 STATIC libnasm1.nasm)
+add_executable(NasmOnly nasmonly.nasm)
+target_link_libraries(NasmOnly testnasm1)
diff --git a/Tests/NasmOnly/libnasm1.nasm b/Tests/NasmOnly/libnasm1.nasm
new file mode 100644
index 0000000..c72a1ad
--- /dev/null
+++ b/Tests/NasmOnly/libnasm1.nasm
@@ -0,0 +1,6 @@
+global LibNasm1Func
+
+section .text
+LibNasm1Func:
+ mov rax, 1
+ ret
diff --git a/Tests/NasmOnly/nasmonly.nasm b/Tests/NasmOnly/nasmonly.nasm
new file mode 100644
index 0000000..db9b655
--- /dev/null
+++ b/Tests/NasmOnly/nasmonly.nasm
@@ -0,0 +1,19 @@
+global _start
+
+extern LibNasm1Func
+
+section .text
+_start:
+ xor rax, rax
+ call LibNasm1Func
+ cmp rax, 1
+ jne err
+
+ mov rax, 60
+ xor rdi, rdi
+ syscall
+
+err:
+ mov rax, 60
+ mov rdi, 1
+ syscall