Hey everyone, I’ve been having some issues with my cmake script. Specifically with the ExternalProject_Add function, it seems like it is not being executed or rather it is being executed but the problem is that it is not cloning the github repository, the dirs are being created but they are empty and no logs seem to be generated. The FetchContent_Declare is working just fine.
Here is my script:
cmake_minimum_required(VERSION 3.28)
project(BigGold)
set(CMAKE_CXX_STANDARD 20)
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
# Now find_package should work
add_executable(BigGold main.cpp
DAO/bigmacdao.cpp
DAO/bigmacdao.h)
set(RESOURCE_DIR "${CMAKE_SOURCE_DIR}/Resources")
set(DESTINATION_DIR "${CMAKE_BINARY_DIR}/Resources")
include(FetchContent)
include(ExternalProject)
set(BUILD_SHARED_LIBS OFF)
FetchContent_Declare(cpr GIT_REPOSITORY https://github.com/libcpr/cpr.git
GIT_TAG 3b15fa82ea74739b574d705fea44959b58142eb8) # Replace with your desired git commit from: https://github.com/libcpr/cpr/releases
FetchContent_MakeAvailable(cpr)
FetchContent_Declare(
asio
GIT_REPOSITORY https://github.com/chriskohlhoff/asio.git
GIT_TAG asio-1-18-0
)
FetchContent_MakeAvailable(asio)
add_library(asio INTERFACE)
# Directory where Arrow will be installed
set(ARROW_INSTALL_DIR ${CMAKE_BINARY_DIR}/arrow-install)
set(EP_LOG_LEVEL DEBUG)
set(CMAKE_VERBOSE_MAKEFILE ON)
# Clone and build Apache Arrow
ExternalProject_Add(arrow_project
GIT_REPOSITORY "https://github.com/apache/arrow.git"
GIT_TAG "main" # Change this to the specific version you want
SOURCE_DIR ${CMAKE_BINARY_DIR}/arrow-src
BINARY_DIR ${CMAKE_BINARY_DIR}/arrow-build
CMAKE_ARGS
-DARROW_BUILD_STATIC=ON
-DARROW_BUILD_SHARED=OFF
-DARROW_BUILD_TESTS=OFF
-DCMAKE_INSTALL_PREFIX=${ARROW_INSTALL_DIR}
BUILD_COMMAND cmake --build .
INSTALL_COMMAND cmake --install . --prefix ${ARROW_INSTALL_DIR}
UPDATE_DISCONNECTED 1
LOG_DOWNLOAD ON
LOG_CONFIGURE ON
LOG_BUILD ON
LOG_INSTALL ON
)
# Add Arrow's include and library paths after it's built
include_directories(${ARROW_INSTALL_DIR}/include)
link_directories(${ARROW_INSTALL_DIR}/lib)
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
message(STATUS "Building on Windows")
execute_process(
COMMAND ${Python3_EXECUTABLE} -m pybind11 --includes
OUTPUT_VARIABLE PYBIND11_INCLUDES
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Remove the '-I' prefix and replace '-I' with ';' to split into a list
# Remove the '-I' prefix and replace '-I' with ';' to split into a list
string(REPLACE "-I" ";" PYBIND11_INCLUDE_DIRS "${PYBIND11_INCLUDES}")
# Remove leading semicolon, if any
string(REGEX REPLACE "^;" "" PYBIND11_INCLUDE_DIRS "${PYBIND11_INCLUDE_DIRS}")
# Now, we need to filter the include paths to keep only the one containing "pybind11"
foreach(INCLUDE_DIR ${PYBIND11_INCLUDE_DIRS})
if(INCLUDE_DIR MATCHES ".*pybind11.*")
set(PYBIND11_INCLUDE_DIR ${INCLUDE_DIR})
endif()
endforeach()
target_include_directories(BigGold PUBLIC ${PYBIND11_INCLUDE_DIR})
else()
message(STATUS "Building on an UNIX-BASED OS: ${CMAKE_SYSTEM_NAME}")
find_package(pybind11 REQUIRED)
endif()
# Create a custom command to copy resources
add_custom_command(
TARGET BigGold POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${RESOURCE_DIR} ${DESTINATION_DIR}
COMMENT "Copying resource files to the output directory"
)
target_include_directories(asio INTERFACE ${asio_SOURCE_DIR}/asio/include)
target_link_libraries(BigGold PRIVATE Python3::Python cpr::cpr asio Arrow)
This is the output of the cmake execution:
"D:\Program Files\JetBrains\CLion 2024.1.4\bin\cmake\win\x64\bin\cmake.exe" -DCMAKE_BUILD_TYPE=Debug "-DCMAKE_MAKE_PROGRAM=D:/Program Files/JetBrains/CLion 2024.1.4/bin/ninja/win/x64/ninja.exe" -G Ninja -S "D:\Ingenieria\Programas, proyectos y otros\C++\BigGold" -B "D:\Ingenieria\Programas, proyectos y otros\C++\BigGold\cmake-build-debug"
-- CXX standard of parent project: 20
-- CXX standard: 20
-- C++ Requests CMake Options
-- =======================================================
-- CPR_GENERATE_COVERAGE: OFF
-- CPR_CURL_NOSIGNAL: OFF
-- CURL_VERBOSE_LOGGING: OFF
-- CPR_USE_SYSTEM_GTEST: OFF
-- CPR_USE_SYSTEM_CURL: OFF
-- CPR_ENABLE_CURL_HTTP_ONLY: ON
-- CPR_ENABLE_SSL: ON
-- CPR_FORCE_OPENSSL_BACKEND: OFF
-- CPR_FORCE_WINSSL_BACKEND: OFF
-- CPR_FORCE_DARWINSSL_BACKEND: OFF
-- CPR_FORCE_MBEDTLS_BACKEND: OFF
-- CPR_ENABLE_LINTING: OFF
-- CPR_ENABLE_CPPCHECK: OFF
-- CPR_BUILD_TESTS: OFF
-- CPR_BUILD_TESTS_SSL: OFF
-- CPR_BUILD_TESTS_PROXY: OFF
-- CPR_SKIP_CA_BUNDLE_SEARCH: OFF
-- CPR_USE_BOOST_FILESYSTEM: OFF
-- CPR_DEBUG_SANITIZER_FLAG_THREAD: OFF
-- CPR_DEBUG_SANITIZER_FLAG_ADDR: OFF
-- CPR_DEBUG_SANITIZER_FLAG_LEAK: OFF
-- CPR_DEBUG_SANITIZER_FLAG_UB: OFF
-- CPR_DEBUG_SANITIZER_FLAG_ALL: OFF
-- =======================================================
-- Automatically detecting SSL backend.
-- Detecting SSL backend...
-- SSL auto detect: Using WinSSL.
-- Configuring built-in curl...
-- Using CMake version 3.28.1
-- ZLIB_HEADER_VERSION: 1.2.11
-- ZLIBNG_HEADER_VERSION: 2.0.6
-- Arch detected: 'x86_64'
-- Basearch of 'x86_64' has been detected as: 'x86'
-- Architecture supports unaligned reads
-- Architecture supports unaligned reads of > 4 bytes
-- Architecture-specific source files: arch/x86/x86.c;arch/x86/slide_avx.c;arch/x86/chunkset_avx.c;arch/x86/compare258_avx.c;arch/x86/adler32_avx.c;arch/x86/insert_string_sse.c;arch/x86/compare258_sse.c;arch/x86/chunkset_sse.c;arch/x86/slide_sse.c;arch/x86/adler32_ssse3.c;arch/x86/crc_folding.c
-- The following features have been enabled:
* CMAKE_BUILD_TYPE, Build type: Debug (selected)
* WITH_GZFILEOP, Compile with support for gzFile related functions
* ZLIB_COMPAT, Compile with zlib compatible API
* WITH_OPTIM, Build with optimisation
* WITH_NEW_STRATEGIES, Use new strategies
* WITH_UNALIGNED, Support unaligned reads on platforms that support it
* WITH_AVX2, Build with AVX2
* WITH_SSE2, Build with SSE2
* WITH_SSSE3, Build with SSSE3
* WITH_SSE4, Build with SSE4
* WITH_PCLMULQDQ, Build with PCLMULQDQ
* AVX2_SLIDEHASH, Support AVX2 optimized slide_hash, using ""
* AVX_CHUNKSET, Support AVX optimized chunkset, using ""
* AVX2_COMPARE258, Support AVX2 optimized compare258, using ""
* AVX2_ADLER32, Support AVX2-accelerated adler32, using ""
* SSE42_CRC, Support SSE4.2 optimized CRC hash generation, using ""
* SSE42_COMPARE258, Support SSE4.2 optimized compare258, using ""
* SSSE3_ADLER32, Support SSSE3-accelerated adler32, using ""
* PCLMUL_CRC, Support CRC hash generation using PCLMULQDQ, using " "
-- The following OPTIONAL packages have been found:
* Git
-- The following REQUIRED packages have been found:
* Python3
-- The following features have been disabled:
* ZLIB_ENABLE_TESTS, Build test binaries
* ZLIB_DUAL_LINK, Dual link tests against system zlib
* WITH_FUZZERS, Build test/fuzz
* WITH_NATIVE_INSTRUCTIONS, Instruct the compiler to use the full instruction set on this host (gcc/clang -march=native)
* WITH_MAINTAINER_WARNINGS, Build with project maintainer warnings
* WITH_CODE_COVERAGE, Enable code coverage reporting
* WITH_INFLATE_STRICT, Build with strict inflate distance checking
* WITH_INFLATE_ALLOW_INVALID_DIST, Build with zero fill for inflate invalid distances
* INSTALL_UTILS, Copy minigzip and minideflate during install
-- Enabled curl SSL
-- curl version=[8.4.0]
-- Could NOT find Perl (missing: PERL_EXECUTABLE)
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
-- Could NOT find LibPSL (missing: LIBPSL_LIBRARY LIBPSL_INCLUDE_DIR)
-- Could NOT find LibSSH2 (missing: LIBSSH2_LIBRARY LIBSSH2_INCLUDE_DIR)
-- Performing Curl Test HAVE_WIN32_WINNT
-- Performing Curl Test HAVE_WIN32_WINNT - Success
-- Found _WIN32_WINNT=0x0A00
-- Enabled features: SSL IPv6 unixsockets AsynchDNS Largefile SSPI alt-svc HSTS SPNEGO Kerberos NTLM HTTPS-proxy threadsafe
-- Enabled protocols: HTTP HTTPS
-- Enabled SSL backends: Schannel
-- Building on Windows
-- Configuring done (3.5s)
-- Generating done (0.0s)
-- Build files have been written to: D:/Ingenieria/Programas, proyectos y otros/C++/BigGold/cmake-build-debug
[Finished]
I hope somebody can help me to solve this issue. Thanks in advance