Skip to content

Commit

Permalink
Refactor CMakeLists.txt files
Browse files Browse the repository at this point in the history
  • Loading branch information
NeilJustice committed Dec 30, 2024
1 parent 587bf20 commit ad3dd3c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if(UNIX)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
append(CMAKE_CXX_FLAGS "-Wno-gnu-zero-variadic-macro-arguments")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
append(CMAKE_CXX_FLAGS "-no-pie -fopenmp -fuse-ld=lld")
append(CMAKE_CXX_FLAGS "-no-pie -fopenmp")
endif()
if(FastLinuxDebugBuildMode)
replace(CMAKE_CXX_FLAGS_DEBUG "-g" "")
Expand Down
13 changes: 8 additions & 5 deletions FileArb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ include_directories(${CMAKE_SOURCE_DIR})

add_executable(FileArb FileArbMain.cpp)

if(UNIX)
set_target_properties(FileArb PROPERTIES OUTPUT_NAME filearb)
endif()
target_link_libraries(FileArb libFileArb)
if(MSVC)
if(UNIX)
set_property(TARGET FileArb PROPERTY LINKER_TYPE LLD)
elseif(MSVC)
replace(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/Ob1" "/Ob2")
append(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/Oi /Ot /GS- /arch:AVX2 /fp:fast")
replace(CMAKE_EXE_LINKER_FLAGS_DEBUG "/debug" "/DEBUG:FASTLINK")
Expand All @@ -20,7 +19,11 @@ endif()

install(TARGETS FileArb DESTINATION "bin")

if(UNIX AND NOT APPLE)
if(UNIX)
set_target_properties(FileArb PROPERTIES OUTPUT_NAME filearb)
endif()

if(UNIX)
target_link_libraries(FileArb stdc++fs)
if(LCovCodeCoverageMode)
target_link_libraries(FileArb CodeCovLibraryInterface)
Expand Down
10 changes: 5 additions & 5 deletions libFileArbTests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@ source_group("" FILES ${Sources})

add_executable(libFileArbTests ${Sources})
target_link_libraries(libFileArbTests libFileArb)

if(MSVC)
if(UNIX)
set_property(TARGET libFileArbTests PROPERTY LINKER_TYPE LLD)
elseif(MSVC)
replace(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/O2" "/Od")
replace(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/Ob2" "/Ob0")
replace(CMAKE_EXE_LINKER_FLAGS_DEBUG "/debug" "/DEBUG:FASTLINK")
replace(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "/debug" "")
IfMSVCEnablePrecompiledHeaders()
IfMSVCAddRunTestsPostBuildStep()
endif()

if(UNIX)
if(LCovCodeCoverageMode)
target_link_libraries(libFileArbTests CodeCovLibraryInterface)
endif()
endif()

IfMSVCEnablePrecompiledHeaders()
IfMSVCAddRunTestsPostBuildStep()

0 comments on commit ad3dd3c

Please sign in to comment.