Skip to content

Commit

Permalink
build: Fixed cmake not using default settings on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
WerWolv committed Aug 5, 2023
1 parent f2cfc70 commit fae8f0a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
26 changes: 8 additions & 18 deletions cmake/build_helpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -291,44 +291,34 @@ macro(configureCMake)
find_program(RANLIB_LLVMLIBS_PATH llvm-ranlib)

if (CCACHE_PATH)
if (NOT CMAKE_C_COMPILER_LAUNCHER AND NOT CMAKE_CXX_COMPILER_LAUNCHER)
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_PATH})
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_PATH})
endif ()
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_PATH})
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_PATH})
else ()
message(WARNING "ccache not found!")
endif ()

if (AR_LLVMLIBS_PATH)
if (NOT CMAKE_AR)
set(CMAKE_AR ${AR_LLVMLIBS_PATH})
endif ()
set(CMAKE_AR ${AR_LLVMLIBS_PATH})
else ()
message(WARNING "llvm-ar not found, using default ar!")
endif ()

if (RANLIB_LLVMLIBS_PATH)
if (NOT CMAKE_RANLIB)
set(CMAKE_RANLIB ${RANLIB_LLVMLIBS_PATH})
endif ()
set(CMAKE_RANLIB ${RANLIB_LLVMLIBS_PATH})
else ()
message(WARNING "llvm-ranlib not found, using default ranlib!")
endif ()

if (LD_LLD_PATH)
if (NOT CMAKE_LINKER)
set(CMAKE_LINKER ${LD_LLD_PATH})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fuse-ld=lld")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=lld")
endif ()
set(CMAKE_LINKER ${LD_LLD_PATH})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fuse-ld=lld")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=lld")
else ()
message(WARNING "lld not found, using default linker!")
endif ()

if (NINJA_PATH)
if (NOT CMAKE_GENERATOR)
set(CMAKE_GENERATOR Ninja)
endif ()
set(CMAKE_GENERATOR Ninja)
else ()
message(WARNING "ninja not found, using default generator!")
endif ()
Expand Down
2 changes: 2 additions & 0 deletions lib/external/yara/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ else ()
endif ()

include(GNUInstallDirs)

file(REMOVE ${CMAKE_CURRENT_SOURCE_DIR}/yara/yara.pc)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/yara/yara.pc.in
${CMAKE_CURRENT_SOURCE_DIR}/yara/yara.pc @ONLY)
set(CMAKE_STATIC_LIBRARY_PREFIX "")

0 comments on commit fae8f0a

Please sign in to comment.