Skip to content

Commit

Permalink
Rework compiler & linker options
Browse files Browse the repository at this point in the history
  • Loading branch information
gavv committed May 20, 2024
1 parent 680cf22 commit 5aeb432
Showing 1 changed file with 10 additions and 21 deletions.
31 changes: 10 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 5aeb432

Please sign in to comment.