From 87862e9fd6e4b17f0b977de0ac6e0ca2efa63b96 Mon Sep 17 00:00:00 2001 From: WangRunji Date: Fri, 4 Jan 2019 22:40:56 +0800 Subject: [PATCH] fix compile on Linux --- CMakeLists.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fcb1ab7..6fe0c4d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,18 +20,18 @@ if (${ARCH} STREQUAL i386) if(APPLE) set(PREFIX i386-elf-) endif () - set(CMAKE_C_FLAGS "-fno-builtin -Wall -ggdb -nostdinc -m32") + set(CMAKE_C_FLAGS "-m32") elseif (${ARCH} STREQUAL x86_64) if(APPLE) set(PREFIX x86_64-elf-) endif () - set(CMAKE_C_FLAGS "-fno-builtin -Wall -ggdb -nostdinc -m64") + set(CMAKE_C_FLAGS "-m64") elseif (${ARCH} STREQUAL riscv32) set(PREFIX riscv64-unknown-elf-) - set(CMAKE_C_FLAGS "-march=rv32imac -mabi=ilp32 -mcmodel=medany -std=gnu99 -fno-builtin -Wall -nostdinc -fno-stack-protector -ffunction-sections -fdata-sections") + set(CMAKE_C_FLAGS "-march=rv32imac -mabi=ilp32 -mcmodel=medany") elseif (${ARCH} STREQUAL riscv64) set(PREFIX riscv64-unknown-elf-) - set(CMAKE_C_FLAGS "-march=rv64imac -mabi=lp64 -mcmodel=medany -std=gnu99 -fno-builtin -Wall -nostdinc -fno-stack-protector -ffunction-sections -fdata-sections") + set(CMAKE_C_FLAGS "-march=rv64imac -mabi=lp64 -mcmodel=medany") elseif (${ARCH} STREQUAL aarch64) set(PREFIX aarch64-none-elf-) else() @@ -39,7 +39,9 @@ else() endif () set(CMAKE_C_COMPILER ${PREFIX}gcc) set(CMAKE_RANLIB ${PREFIX}ranlib) +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-builtin -nostdinc -fno-stack-protector -ggdb -Wall") set(CMAKE_EXE_LINKER_FLAGS "-nostdlib") +set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS) # get rid of '-rdynamic' on Linux # Library add_library(ulib ${LIBS})