cmake_minimum_required(VERSION 3.13.1) set(IS_OS_WINDOWS FALSE) set(IS_OS_LINUX FALSE) set(IS_OS_MAC FALSE) set(IS_ARCH_AMD64 FALSE) set(IS_ARCH_X86 FALSE) set(IS_ARCH_ARM64 FALSE) set(IS_ARCH_ARM FALSE) project(CustomHeapManager C) if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows") set(IS_OS_WINDOWS TRUE) set(USER_HOME_DIRECTORY $ENV{USERPROFILE}) message("Building for the Windows operating system.") elseif (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux") set(IS_OS_LINUX TRUE) set(USER_HOME_DIRECTORY $ENV{HOME}) add_compile_options(-Wno-stringop-overflow) message("Building for the Linux operating system.") elseif (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin") set(IS_OS_MAC TRUE) set(USER_HOME_DIRECTORY $ENV{HOME}) message("Building for the Mac operating system.") endif () if ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "AMD64" OR "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64") set(IS_ARCH_AMD64 TRUE) enable_language(ASM_NASM) message("Building for the AMD64 architecture.") elseif ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "arm64" OR "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64") set(IS_ARCH_ARM64 TRUE) enable_language(ASM) message("Building for the ARM64 architecture.") endif () set(CMAKE_C_STANDARD 11) add_executable(CustomHeapManager src/CHM.c include/CHM.h src/main.c ) target_include_directories(CustomHeapManager PUBLIC ${PROJECT_SOURCE_DIR}/include)