From 54845b5aba4e759c5a7db89226b9e824c7ef1d6c Mon Sep 17 00:00:00 2001 From: Mathias Preiner Date: Tue, 4 May 2021 09:55:28 -0700 Subject: [PATCH] cmake: Fix ninja build. (#6481) --- cmake/FindCaDiCaL.cmake | 12 ++++++++++-- cmake/FindKissat.cmake | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/cmake/FindCaDiCaL.cmake b/cmake/FindCaDiCaL.cmake index 9f8289cb9..a2bead06b 100644 --- a/cmake/FindCaDiCaL.cmake +++ b/cmake/FindCaDiCaL.cmake @@ -61,6 +61,14 @@ if(NOT CaDiCaL_FOUND_SYSTEM) set(CXXFLAGS "${CXXFLAGS} -DNUNLOCKED") endif() + if("${CMAKE_GENERATOR}" STREQUAL "Unix Makefiles") + # use $(MAKE) instead of "make" to allow for parallel builds + set(make_cmd "$(MAKE)") + else() + # $(MAKE) does not work with ninja + set(make_cmd "make") + endif() + ExternalProject_Add( CaDiCaL-EP ${COMMON_EP_CONFIG} @@ -75,12 +83,12 @@ if(NOT CaDiCaL_FOUND_SYSTEM) sed -i.orig -e "s,@CXX@,${CMAKE_CXX_COMPILER}," -e "s,@CXXFLAGS@,${CXXFLAGS}," -e "s,@MAKEFLAGS@,," /build/makefile - # use $(MAKE) instead of "make" to allow for parallel builds - BUILD_COMMAND $(MAKE) -C /build libcadical.a + BUILD_COMMAND ${make_cmd} -C /build libcadical.a INSTALL_COMMAND ${CMAKE_COMMAND} -E copy /build/libcadical.a /lib/libcadical.a COMMAND ${CMAKE_COMMAND} -E copy /src/cadical.hpp /include/cadical.hpp + BUILD_BYPRODUCTS /lib/libcadical.a ) set(CaDiCaL_INCLUDE_DIR "${DEPS_BASE}/include/") diff --git a/cmake/FindKissat.cmake b/cmake/FindKissat.cmake index 08b214961..e257d2b3d 100644 --- a/cmake/FindKissat.cmake +++ b/cmake/FindKissat.cmake @@ -63,6 +63,7 @@ if(NOT Kissat_FOUND_SYSTEM) /lib/libkissat.a COMMAND ${CMAKE_COMMAND} -E copy /src/kissat.h /include/kissat/kissat.h + BUILD_BYPRODUCTS /lib/libkissat.a ) set(Kissat_INCLUDE_DIR "${DEPS_BASE}/include/") -- 2.30.2