Skip to content

Commit 3308ca8

Browse files
committed
Update CMakeLists.txt
1 parent b815c6c commit 3308ca8

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

CMakeLists.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
cmake_minimum_required(VERSION 3.16)
2-
project(BasicallyLinux C ASM_NASM)
32

4-
# NASM flags for 32-bit ELF (Must be set before enable_language or forced)
3+
# Set NASM flags BEFORE the project() call to ensure they are used during initialization
54
set(CMAKE_ASM_NASM_FLAGS "-f elf32" CACHE STRING "NASM flags" FORCE)
65

7-
# Enable NASM support
8-
enable_language(ASM_NASM)
6+
project(BasicallyLinux C ASM_NASM)
97

108
# Toolchain configuration (can be overridden by command line)
119
set(CMAKE_C_COMPILER i686-linux-gnu-gcc)
@@ -33,6 +31,11 @@ include_directories(include)
3331
file(GLOB_RECURSE ASM_SOURCES "src/*.asm")
3432
file(GLOB_RECURSE C_SOURCES "src/*.c")
3533

34+
# Force -f elf32 on all assembly files explicitly as well
35+
foreach(asm_file ${ASM_SOURCES})
36+
set_source_files_properties(${asm_file} PROPERTIES COMPILE_FLAGS "-f elf32")
37+
endforeach()
38+
3639
# Exclude specific files if needed
3740
list(FILTER C_SOURCES EXCLUDE REGEX "src/drivers/vga.c")
3841

0 commit comments

Comments
 (0)