mimalloc-bench
mimalloc-bench copied to clipboard
CMAKE_C?_FLAGS are not lists but strings
https://github.com/daanx/mimalloc-bench/blob/6e4bbc7feaf51e3e94aa7a470a535a22e16e1d02/bench/CMakeLists.txt#L44
CMake lists are semicolon-separated affairs so appending flags to CMAKE_C?_FLAGS with list(APPEND CMAKE_C?_FLAGS "-foo -bar") will introduce a semicolon in the final compiler invocation if those flags aren't empty. Which can be the case if the user calls CMake with CFLAGS and/or CXXFLAGS in the environment.
The proper way to append compiler flags is a string append operation, e.g.
if(CMAKE_C_COMPILER_ID MATCHES "AppleClang|Clang|GNU")
set(FLAGS " -w -Wno-implicit-function-declaration -Wno-implicit-int -Wno-int-conversion")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAGS}")
endif()
Care to send a pull-request?
Really, for such a small & trivial change?
I had the files open, so pushed a PR. https://github.com/daanx/mimalloc-bench/pull/192