From bb2f85aa2b3ce3980dc32095e151340c16efbce0 Mon Sep 17 00:00:00 2001 From: Keita Iwabuchi Date: Tue, 30 Jan 2024 15:48:04 -0800 Subject: [PATCH] Bugfix: detect Linux in CMake --- CMakeLists.txt | 4 ++-- tutorial/nvmw21/CMakeLists.txt | 2 +- verification/sparse_copy/CMakeLists.txt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f06a9f29..5c64eba4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -214,7 +214,7 @@ function(add_common_compile_options name) target_compile_options(${name} PRIVATE $<$:-Og>) target_compile_options(${name} PRIVATE $<$:-g3>) target_compile_options(${name} PRIVATE $<$:-Wextra>) - if (Linux) + if (CMAKE_SYSTEM_NAME STREQUAL "Linux") target_compile_options(${name} PRIVATE $<$:-pg>) endif () @@ -225,7 +225,7 @@ function(add_common_compile_options name) # Release with debug info target_compile_options(${name} PRIVATE $<$:-Ofast>) target_compile_options(${name} PRIVATE $<$:-g3>) - if (Linux) + if (CMAKE_SYSTEM_NAME STREQUAL "Linux") target_compile_options(${name} PRIVATE $<$:-pg>) endif () endfunction() diff --git a/tutorial/nvmw21/CMakeLists.txt b/tutorial/nvmw21/CMakeLists.txt index 0efa9a25..901bf852 100644 --- a/tutorial/nvmw21/CMakeLists.txt +++ b/tutorial/nvmw21/CMakeLists.txt @@ -9,7 +9,7 @@ set(CMAKE_CXX_FLAGS "-Wall -pthread") # Debug set(CMAKE_CXX_FLAGS_DEBUG "-O0") -if (Linux) +if (CMAKE_SYSTEM_NAME STREQUAL "Linux") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -pg") endif () diff --git a/verification/sparse_copy/CMakeLists.txt b/verification/sparse_copy/CMakeLists.txt index 10eebbcb..7900ce67 100644 --- a/verification/sparse_copy/CMakeLists.txt +++ b/verification/sparse_copy/CMakeLists.txt @@ -1,5 +1,5 @@ add_metall_executable(verify_sparse_copy verify_sparse_copy.cpp) -if (Linux) +if (CMAKE_SYSTEM_NAME STREQUAL "Linux") add_metall_executable(verify_sparse_copy_syscalls verify_sparse_copy_syscalls.cpp) endif ()