NASM: Fix object format when CXX is enabled but not C

Check CXX data pointer size if C is not set.
This commit is contained in:
Christian Feldmann 2020-04-20 16:35:01 +02:00 committed by Brad King
parent 348a2a9734
commit 3328e0a387

View File

@ -8,19 +8,25 @@ set(CMAKE_ASM_NASM_SOURCE_FILE_EXTENSIONS nasm asm)
if(NOT CMAKE_ASM_NASM_OBJECT_FORMAT) if(NOT CMAKE_ASM_NASM_OBJECT_FORMAT)
if(WIN32) if(WIN32)
if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8) if(DEFINED CMAKE_C_SIZEOF_DATA_PTR AND CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
set(CMAKE_ASM_NASM_OBJECT_FORMAT win64)
elseif(DEFINED CMAKE_CXX_SIZEOF_DATA_PTR AND CMAKE_CXX_SIZEOF_DATA_PTR EQUAL 8)
set(CMAKE_ASM_NASM_OBJECT_FORMAT win64) set(CMAKE_ASM_NASM_OBJECT_FORMAT win64)
else() else()
set(CMAKE_ASM_NASM_OBJECT_FORMAT win32) set(CMAKE_ASM_NASM_OBJECT_FORMAT win32)
endif() endif()
elseif(APPLE) elseif(APPLE)
if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8) if(DEFINED CMAKE_C_SIZEOF_DATA_PTR AND CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
set(CMAKE_ASM_NASM_OBJECT_FORMAT macho64)
elseif(DEFINED CMAKE_CXX_SIZEOF_DATA_PTR AND CMAKE_CXX_SIZEOF_DATA_PTR EQUAL 8)
set(CMAKE_ASM_NASM_OBJECT_FORMAT macho64) set(CMAKE_ASM_NASM_OBJECT_FORMAT macho64)
else() else()
set(CMAKE_ASM_NASM_OBJECT_FORMAT macho) set(CMAKE_ASM_NASM_OBJECT_FORMAT macho)
endif() endif()
else() else()
if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8) if(DEFINED CMAKE_C_SIZEOF_DATA_PTR AND CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
set(CMAKE_ASM_NASM_OBJECT_FORMAT elf64)
elseif(DEFINED CMAKE_CXX_SIZEOF_DATA_PTR AND CMAKE_CXX_SIZEOF_DATA_PTR EQUAL 8)
set(CMAKE_ASM_NASM_OBJECT_FORMAT elf64) set(CMAKE_ASM_NASM_OBJECT_FORMAT elf64)
else() else()
set(CMAKE_ASM_NASM_OBJECT_FORMAT elf) set(CMAKE_ASM_NASM_OBJECT_FORMAT elf)