From 5aeb432886a1751c275513ef6babd9bafa58779e Mon Sep 17 00:00:00 2001 From: Victor Gaydov Date: Mon, 20 May 2024 14:59:11 +0400 Subject: [PATCH] Rework compiler & linker options --- CMakeLists.txt | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c4b61d..309bda1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -149,28 +149,17 @@ if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release") endif() -if(NOT CMAKE_C_FLAGS MATCHES "-fPIC") - set(CMAKE_C_FLAGS - "${CMAKE_C_FLAGS} -fPIC") -endif() - -if(CMAKE_C_COMPILER_ID STREQUAL "GNU") - set(CMAKE_C_FLAGS - "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-variable") -endif() - -if(CMAKE_C_COMPILER_ID STREQUAL "Clang") - set(CMAKE_C_FLAGS - "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-variable") -endif() - -set(THREADS_PREFER_PTHREAD_FLAG ON) -find_package(Threads REQUIRED) -link_libraries(Threads::Threads) +add_compile_options( + "-Wall" + "-Wextra" + "-Wno-unused-variable" + "-fPIC" + "-pthread" +) -# for libroc.a -link_libraries( - "stdc++" +add_link_options( + "-pthread" + "-lstdc++" ) add_definitions(