Use CppADCodeGen with CMake FetchContent or ExternalProject - c++

I am not good with CMake, and I cannot find good explanations about how to use its FetchContent functionality. Indeed, most repositories seem to require different treatment, and the rules of such treatment defy my comprehension.
That said, here is my problem. I would like to use CppADCodeGen in my project using CMake FetchContent. Here is my code:
include(FetchContent)
message(STATUS "Fetching eigen...")
FetchContent_Declare(
eigen
GIT_REPOSITORY https://gitlab.com/libeigen/eigen.git
GIT_TAG 3.4.0
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE)
option(EIGEN_BUILD_DOC OFF)
option(BUILD_TESTING OFF)
option(EIGEN_LEAVE_TEST_IN_ALL_TARGET OFF)
option(EIGEN_BUILD_PKGCONFIG OFF)
FetchContent_MakeAvailable(eigen)
message(STATUS "Fetching cppad...")
FetchContent_Declare(
cppad
GIT_REPOSITORY https://github.com/coin-or/CppAD.git
GIT_TAG 20210000.8
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE)
FetchContent_MakeAvailable(cppad)
message(STATUS "Fetching cppadcodgen...")
FetchContent_Declare(
cppadcodgen
GIT_REPOSITORY https://github.com/joaoleal/CppADCodeGen.git
GIT_TAG v2.4.3
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE)
FetchContent_MakeAvailable(cppadcodgen)
Here is the output and the errors I get:
[cmake] Not searching for unused variables given on the command line.
[cmake] -- The C compiler identification is GNU 11.1.0
[cmake] -- The CXX compiler identification is GNU 11.1.0
[cmake] -- Detecting C compiler ABI info
[cmake] -- Detecting C compiler ABI info - done
[cmake] -- Check for working C compiler: /bin/x86_64-linux-gnu-gcc-11 - skipped
[cmake] -- Detecting C compile features
[cmake] -- Detecting C compile features - done
[cmake] -- Detecting CXX compiler ABI info
[cmake] -- Detecting CXX compiler ABI info - done
[cmake] -- Check for working CXX compiler: /bin/x86_64-linux-gnu-g++-11 - skipped
[cmake] -- Detecting CXX compile features
[cmake] -- Detecting CXX compile features - done
[cmake] -- Fetching eigen...
[cmake] -- Performing Test EIGEN_COMPILER_SUPPORT_CPP11
[cmake] -- Performing Test EIGEN_COMPILER_SUPPORT_CPP11 - Success
[cmake] -- Performing Test COMPILER_SUPPORT_std=cpp03
[cmake] -- Performing Test COMPILER_SUPPORT_std=cpp03 - Success
[cmake] -- Performing Test standard_math_library_linked_to_automatically
[cmake] -- Performing Test standard_math_library_linked_to_automatically - Success
[cmake] -- Standard libraries to link to explicitly: none
[cmake] -- Performing Test COMPILER_SUPPORT_WERROR
[cmake] -- Performing Test COMPILER_SUPPORT_WERROR - Success
[cmake] -- Performing Test COMPILER_SUPPORT_pedantic
[cmake] -- Performing Test COMPILER_SUPPORT_pedantic - Success
[cmake] -- Performing Test COMPILER_SUPPORT_Wall
[cmake] -- Performing Test COMPILER_SUPPORT_Wall - Success
[cmake] -- Performing Test COMPILER_SUPPORT_Wextra
[cmake] -- Performing Test COMPILER_SUPPORT_Wextra - Success
[cmake] -- Performing Test COMPILER_SUPPORT_Wundef
[cmake] -- Performing Test COMPILER_SUPPORT_Wundef - Success
[cmake] -- Performing Test COMPILER_SUPPORT_Wcastalign
[cmake] -- Performing Test COMPILER_SUPPORT_Wcastalign - Success
[cmake] -- Performing Test COMPILER_SUPPORT_Wcharsubscripts
[cmake] -- Performing Test COMPILER_SUPPORT_Wcharsubscripts - Success
[cmake] -- Performing Test COMPILER_SUPPORT_Wnonvirtualdtor
[cmake] -- Performing Test COMPILER_SUPPORT_Wnonvirtualdtor - Success
[cmake] -- Performing Test COMPILER_SUPPORT_Wunusedlocaltypedefs
[cmake] -- Performing Test COMPILER_SUPPORT_Wunusedlocaltypedefs - Success
[cmake] -- Performing Test COMPILER_SUPPORT_Wpointerarith
[cmake] -- Performing Test COMPILER_SUPPORT_Wpointerarith - Success
[cmake] -- Performing Test COMPILER_SUPPORT_Wwritestrings
[cmake] -- Performing Test COMPILER_SUPPORT_Wwritestrings - Success
[cmake] -- Performing Test COMPILER_SUPPORT_Wformatsecurity
[cmake] -- Performing Test COMPILER_SUPPORT_Wformatsecurity - Success
[cmake] -- Performing Test COMPILER_SUPPORT_Wshorten64to32
[cmake] -- Performing Test COMPILER_SUPPORT_Wshorten64to32 - Failed
[cmake] -- Performing Test COMPILER_SUPPORT_Wlogicalop
[cmake] -- Performing Test COMPILER_SUPPORT_Wlogicalop - Success
[cmake] -- Performing Test COMPILER_SUPPORT_Wenumconversion
[cmake] -- Performing Test COMPILER_SUPPORT_Wenumconversion - Success
[cmake] -- Performing Test COMPILER_SUPPORT_Wcpp11extensions
[cmake] -- Performing Test COMPILER_SUPPORT_Wcpp11extensions - Failed
[cmake] -- Performing Test COMPILER_SUPPORT_Wdoublepromotion
[cmake] -- Performing Test COMPILER_SUPPORT_Wdoublepromotion - Success
[cmake] -- Performing Test COMPILER_SUPPORT_Wshadow
[cmake] -- Performing Test COMPILER_SUPPORT_Wshadow - Success
[cmake] -- Performing Test COMPILER_SUPPORT_Wnopsabi
[cmake] -- Performing Test COMPILER_SUPPORT_Wnopsabi - Success
[cmake] -- Performing Test COMPILER_SUPPORT_Wnovariadicmacros
[cmake] -- Performing Test COMPILER_SUPPORT_Wnovariadicmacros - Success
[cmake] -- Performing Test COMPILER_SUPPORT_Wnolonglong
[cmake] -- Performing Test COMPILER_SUPPORT_Wnolonglong - Success
[cmake] -- Performing Test COMPILER_SUPPORT_fnochecknew
[cmake] -- Performing Test COMPILER_SUPPORT_fnochecknew - Success
[cmake] -- Performing Test COMPILER_SUPPORT_fnocommon
[cmake] -- Performing Test COMPILER_SUPPORT_fnocommon - Success
[cmake] -- Performing Test COMPILER_SUPPORT_fstrictaliasing
[cmake] -- Performing Test COMPILER_SUPPORT_fstrictaliasing - Success
[cmake] -- Performing Test COMPILER_SUPPORT_wd981
[cmake] -- Performing Test COMPILER_SUPPORT_wd981 - Failed
[cmake] -- Performing Test COMPILER_SUPPORT_wd2304
[cmake] -- Performing Test COMPILER_SUPPORT_wd2304 - Failed
[cmake] -- Performing Test COMPILER_SUPPORT_STRICTANSI
[cmake] -- Performing Test COMPILER_SUPPORT_STRICTANSI - Failed
[cmake] -- Performing Test COMPILER_SUPPORT_Qunusedarguments
[cmake] -- Performing Test COMPILER_SUPPORT_Qunusedarguments - Failed
[cmake] -- Performing Test COMPILER_SUPPORT_ansi
[cmake] -- Performing Test COMPILER_SUPPORT_ansi - Success
[cmake] -- Performing Test COMPILER_SUPPORT_OPENMP
[cmake] -- Performing Test COMPILER_SUPPORT_OPENMP - Success
[cmake] -- Looking for a Fortran compiler
[cmake] -- Looking for a Fortran compiler - /usr/bin/f95
[cmake] -- The Fortran compiler identification is GNU 9.3.0
[cmake] -- Detecting Fortran compiler ABI info
[cmake] -- Detecting Fortran compiler ABI info - done
[cmake] -- Check for working Fortran compiler: /usr/bin/f95 - skipped
[cmake] -- Checking whether /usr/bin/f95 supports Fortran 90
[cmake] -- Checking whether /usr/bin/f95 supports Fortran 90 - yes
[cmake] -- Found unsuitable Qt version "5.12.8" from /usr/bin/qmake
[cmake] -- Qt4 not found, so disabling the mandelbrot and opengl demos
[cmake] -- Found CHOLMOD: /usr/include/suitesparse
[cmake] -- Found UMFPACK: /usr/include/suitesparse
[cmake] -- Found KLU: /usr/include/suitesparse
[cmake] -- Performing Test SUPERLU_HAS_GLOBAL_MEM_USAGE_T
[cmake] -- Performing Test SUPERLU_HAS_GLOBAL_MEM_USAGE_T - Success
[cmake] -- Performing Test SUPERLU_HAS_CLEAN_ENUMS
[cmake] -- Performing Test SUPERLU_HAS_CLEAN_ENUMS - Success
[cmake] -- Performing Test SUPERLU_HAS_GLOBALLU_T
[cmake] -- Performing Test SUPERLU_HAS_GLOBALLU_T - Success
[cmake] -- Found SuperLU: /usr/include/superlu (found suitable version "5.0", minimum required is "4.0")
[cmake] -- Checking for one of the modules 'hwloc'
[cmake] -- Performing Test HAVE_HWLOC_PARENT_MEMBER
[cmake] -- Performing Test HAVE_HWLOC_PARENT_MEMBER - Success
[cmake] -- Performing Test HAVE_HWLOC_CACHE_ATTR
[cmake] -- Performing Test HAVE_HWLOC_CACHE_ATTR - Success
[cmake] -- Performing Test HAVE_HWLOC_OBJ_PU
[cmake] -- Performing Test HAVE_HWLOC_OBJ_PU - Success
[cmake] -- Looking for hwloc_bitmap_free in hwloc
[cmake] -- Looking for hwloc_bitmap_free in hwloc - found
[cmake] -- A version of Pastix has been found but pastix_nompi.h does not exist in the include directory. Because Eigen tests require a version without MPI, we disable the Pastix backend.
[cmake] --
[cmake] -- Configured Eigen 3.4.0
[cmake] --
[cmake] -- Available targets (use: make TARGET):
[cmake] -- ---------+--------------------------------------------------------------
[cmake] -- Target | Description
[cmake] -- ---------+--------------------------------------------------------------
[cmake] -- install | Install Eigen. Headers will be installed to:
[cmake] -- | <CMAKE_INSTALL_PREFIX>/<INCLUDE_INSTALL_DIR>
[cmake] -- | Using the following values:
[cmake] -- | CMAKE_INSTALL_PREFIX: /usr/local
[cmake] -- | INCLUDE_INSTALL_DIR: include/eigen3
[cmake] -- | Change the install location of Eigen headers using:
[cmake] -- | cmake . -DCMAKE_INSTALL_PREFIX=yourprefix
[cmake] -- | Or:
[cmake] -- | cmake . -DINCLUDE_INSTALL_DIR=yourdir
[cmake] -- doc | Generate the API documentation, requires Doxygen & LaTeX
[cmake] -- blas | Build BLAS library (not the same thing as Eigen)
[cmake] -- uninstall| Remove files installed by the install target
[cmake] -- ---------+--------------------------------------------------------------
[cmake] --
[cmake] -- Fetching cppad...
[cmake] CMake Deprecation Warning at build/_deps/cppad-src/CMakeLists.txt:20 (CMAKE_MINIMUM_REQUIRED):
[cmake] Compatibility with CMake < 2.8.12 will be removed from a future version of
[cmake] CMake.
[cmake]
[cmake] Update the VERSION argument <min> value or use a ...<max> suffix to tell
[cmake] CMake that the project does not need compatibility with older versions.
[cmake]
[cmake]
[cmake] CMake Warning (dev) at build/_deps/cppad-src/CMakeLists.txt:35 (PROJECT):
[cmake] Policy CMP0048 is not set: project() command manages VERSION variables.
[cmake] Run "cmake --help-policy CMP0048" for policy details. Use the cmake_policy
[cmake] command to set the policy and suppress this warning.
[cmake]
[cmake] The following variable(s) would be set to empty:
[cmake]
[cmake] PROJECT_VERSION
[cmake] PROJECT_VERSION_MAJOR
[cmake] PROJECT_VERSION_MINOR
[cmake] PROJECT_VERSION_PATCH
[cmake] This warning is for project developers. Use -Wno-dev to suppress it.
[cmake]
[cmake] -- Performing Test cppad_cplusplus_201100_ok
[cmake] -- Performing Test cppad_cplusplus_201100_ok - Success
[cmake] -- cppad_cplusplus_201100_ok = 1
[cmake] -- cmake_install_datadir = share
[cmake] -- cmake_install_docdir = NOTFOUND
[cmake] -- cmake_install_includedirs = include
[cmake] -- cmake_install_libdirs = lib
[cmake] -- cppad_prefix = /usr/local
[cmake] -- cppad_postfix = NOTFOUND
[cmake] -- cppad_cxx_flags =
[cmake] -- cppad_profile_flag = NOTFOUND
[cmake] -- cppad_testvector = cppad
[cmake] -- cppad_max_num_threads = 48
[cmake] -- cppad_tape_id_type = unsigned int
[cmake] -- cppad_tape_addr_type = unsigned int
[cmake] -- cppad_debug_which = debug_all
[cmake] -- include_eigen = false
[cmake] -- include_adolc = false
[cmake] -- include_ipopt = false
[cmake] -- include_cppadcg = false
[cmake] -- colpack_prefix = NOTFOUND
[cmake] -- sacado_prefix = NOTFOUND
[cmake] -- fadbad_prefix = NOTFOUND
[cmake] -- CMAKE_CXX_FLAGS_DEBUG = -g
[cmake] -- CMAKE_CXX_FLAGS_RELEASE = -O3 -DNDEBUG
[cmake] -- Found OpenMP_C: -fopenmp (found version "4.5")
[cmake] -- Found OpenMP_CXX: -fopenmp (found version "4.5")
[cmake] -- Found OpenMP: TRUE (found version "4.5")
[cmake] -- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found version "1.71.0") found components: thread
[cmake] -- boost_prefix = /usr
[cmake] -- Found /usr/include
[cmake] -- Found /usr/lib
[cmake] -- Performing Test compiler_has_conversion_warn
[cmake] -- Performing Test compiler_has_conversion_warn - Success
[cmake] -- compiler_has_conversion_warn = 1
[cmake] -- cppad_boostvector = 0
[cmake] -- cppad_cppadvector = 1
[cmake] -- cppad_eigenvector = 0
[cmake] -- cppad_stdvector = 0
[cmake] -- cppad_cplusplus_201100_ok = 1
[cmake] -- Performing Test cppad_has_gettimeofday
[cmake] -- Performing Test cppad_has_gettimeofday - Success
[cmake] -- cppad_has_gettimeofday = 1
[cmake] -- Performing Test cppad_tape_id_type_is_unsigned
[cmake] -- Performing Test cppad_tape_id_type_is_unsigned - Success
[cmake] -- cppad_tape_id_type_is_unsigned = 1
[cmake] -- Performing Test cppad_tape_addr_type_is_unsigned
[cmake] -- Performing Test cppad_tape_addr_type_is_unsigned - Success
[cmake] -- cppad_tape_addr_type_is_unsigned = 1
[cmake] -- Performing Test cppad_max_num_threads_is_integer_ge_4
[cmake] -- Performing Test cppad_max_num_threads_is_integer_ge_4 - Success
[cmake] -- Performing Test cppad_has_mkstemp
[cmake] -- Performing Test cppad_has_mkstemp - Success
[cmake] -- cppad_has_mkstemp = 1
[cmake] -- Performing Test cppad_has_tmpnam_s
[cmake] -- Performing Test cppad_has_tmpnam_s - Failed
[cmake] -- cppad_has_tmpnam_s = 0
[cmake] -- soversion = 712.8
[cmake] -- Not Windows system so building shared cppad_lib
[cmake] -- make check_example_abs_normal: available
[cmake] -- make check_example_atomic_two: available
[cmake] -- make check_example_atomic_three: available
[cmake] -- make check_example_chkpoint_two: available
[cmake] -- make check_example_graph: available
[cmake] -- make check_example_general: available
[cmake] -- make check_example_get_started: available
[cmake] -- make check_example_json: available
[cmake] -- make check_example_multi_thread_openmp: available
[cmake] -- pthread library path = /usr/lib/x86_64-linux-gnu/libpthread.so
[cmake] -- Looking for pthread_barrier_wait in pthread
[cmake] -- Looking for pthread_barrier_wait in pthread - found
[cmake] -- make check_example_multi_thread_pthread: available
[cmake] -- Performing Test boost_multi_thread_ok
[cmake] -- Performing Test boost_multi_thread_ok - Success
[cmake] -- make check_example_multi_thread_bthread: available
[cmake] -- make check_example_multi_thread: available
[cmake] -- make check_example_optimize: available
[cmake] -- make check_example_print_for: available
[cmake] -- make check_example_sparse: available
[cmake] -- make check_example_utility: available
[cmake] -- make check_example: available
[cmake] -- make check_introduction: available
[cmake] -- make check_test_more_deprecated_atomic_two: available
[cmake] -- make check_test_more_deprecated_chkpoint_one: available
[cmake] -- make check_test_more_deprecated: available
[cmake] -- make check_det_by_minor_c: available
[cmake] -- make check_det_by_minor_cpp: available
[cmake] -- make check_test_more_compare_c: available
[cmake] -- make check_test_more_debug_rel: available
[cmake] -- make check_test_more_cppad_for_tmb: available
[cmake] -- make check_test_more_general: available
[cmake] -- make check_test_more: available
[cmake] -- make check_speed_cppad: available
[cmake] -- make check_speed_double: available
[cmake] -- make check_speed_example: available
[cmake] -- make check_speed_program: available
[cmake] -- make check_speed_xpackage: available
[cmake] -- make check_speed: available
[cmake] -- make check: avialable
[cmake] CMake Error at build/_deps/cppad-src/CMakeLists.txt:452 (ADD_CUSTOM_TARGET):
[cmake] ADD_CUSTOM_TARGET cannot create target "uninstall" because another target
[cmake] with the same name already exists. The existing target is a custom target
[cmake] created in source directory
[cmake] "project/build/_deps/eigen-src". See documentation for
[cmake] policy CMP0002 for more details.
[cmake]
[cmake]
[cmake] -- Fetching cppadcodgen...
[cmake] CMake Deprecation Warning at build/_deps/cppadcodgen-src/CMakeLists.txt:18 (CMAKE_MINIMUM_REQUIRED):
[cmake] Compatibility with CMake < 2.8.12 will be removed from a future version of
[cmake] CMake.
[cmake]
[cmake] Update the VERSION argument <min> value or use a ...<max> suffix to tell
[cmake] CMake that the project does not need compatibility with older versions.
[cmake]
[cmake]
[cmake] CMake Warning (dev) at build/_deps/cppadcodgen-src/CMakeLists.txt:20 (PROJECT):
[cmake] Policy CMP0048 is not set: project() command manages VERSION variables.
[cmake] Run "cmake --help-policy CMP0048" for policy details. Use the cmake_policy
[cmake] command to set the policy and suppress this warning.
[cmake]
[cmake] The following variable(s) would be set to empty:
[cmake]
[cmake] PROJECT_VERSION
[cmake] PROJECT_VERSION_MAJOR
[cmake] PROJECT_VERSION_MINOR
[cmake] PROJECT_VERSION_PATCH
[cmake] This warning is for project developers. Use -Wno-dev to suppress it.
[cmake]
[cmake] -- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
[cmake] -- Found CppAD: project/build/_deps/cppad-src/include (Required is at least version "20200000.1")
[cmake] CMake Error at build/_deps/cppadcodgen-src/cmake/FindCppAD.cmake:86 (FILE):
[cmake] FILE STRINGS file
[cmake] "project/build/_deps/cppadcodgen-src/CPPAD_INCLUDE_DIR-NOTFOUND/cppad/configure.hpp"
[cmake] cannot be read.
[cmake] Call Stack (most recent call first):
[cmake] build/_deps/cppadcodgen-src/CMakeLists.txt:42 (FIND_PACKAGE)
[cmake]
[cmake]
[cmake] CMake Error at build/_deps/cppadcodgen-src/cmake/FindCppAD.cmake:99 (MESSAGE):
[cmake] Found CppAD version '' but at least version '20200000.1' is required
[cmake] Call Stack (most recent call first):
[cmake] build/_deps/cppadcodgen-src/CMakeLists.txt:42 (FIND_PACKAGE)
[cmake]
[cmake]
[cmake] -- Configuring incomplete, errors occurred!
Is anyone able to achieve the above goal on their machine? If yes, would they kindly share how they did it? In the above error messages there are several errors, and I have already tried some solutions, but none of them worked -- I will not list them because they are no use mentioning!
EDIT
#dlivshen When I integrated my library with a bigger project, I had more problems due to conflicting target names. This is because I used FetchContent to get Eigen. So I decided to obtain it using ExternalProject, and for this purpose I added these lines to the CMakeLists.txt.in file you proposed in your solution:
ExternalProject_Add(
eigen
GIT_REPOSITORY https://gitlab.com/libeigen/eigen.git
GIT_TAG 3.4.0
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
CMAKE_CACHE_ARGS
-DCMAKE_INSTALL_PREFIX:STRING=${CMAKE_BINARY_DIR}/eigen
-DEIGEN_BUILD_DOC
OFF
-DBUILD_TESTING
OFF
-DEIGEN_LEAVE_TEST_IN_ALL_TARGET
OFF
-DEIGEN_BUILD_PKGCONFIG
OFF)
Then, in order to use Eigen I have to necessarily add ${CMAKE_BINARY_DIR}/eigen/include/eigen3 to the target_include_directories command. This is in contrast to when I used FetchContent whereby I only needed to add Eigen3::Eigen to the target_link_libraries command. This approach is not possible with ExternalProject: is this statement correct? If not, how can I achieve it?

Problems Overview
As seen in the output you've provided, there are 2 problems:
There is a target name conflict between probably CppAD and eigen. They both have the uninstall target. It can be seen here:
[cmake] CMake Error at build/_deps/cppad-src/CMakeLists.txt:452 (ADD_CUSTOM_TARGET):
[cmake] ADD_CUSTOM_TARGET cannot create target "uninstall" because another target
[cmake] with the same name already exists. The existing target is a custom target
[cmake] created in source directory
[cmake] "project/build/_deps/eigen-src".
cppadcodgen requires an already installed version of CppAD. It can be seen in the error message which tells us that an invalid version was found:
[cmake] CMake Error at build/_deps/cppadcodgen-src/cmake/FindCppAD.cmake:99 (MESSAGE):
[cmake] Found CppAD version '' but at least version '20200000.1' is required
[cmake] Call Stack (most recent call first):
[cmake] build/_deps/cppadcodgen-src/CMakeLists.txt:42 (FIND_PACKAGE)
Solution
Unfortunately, currently we can't use FetchContent to deal with those problems, because:
There isn't any mechanism that would allow us distinguishing conflicting targets (for example a "namespace" prefix could be a solution and then there could be 2 targets eigen:uninstall and cppad:uninstall).
We can't build the dependent target during configuration step.
Instead we'll use the ExternalProject module. Here's a possible solution:
include(FetchContent)
message(STATUS "Fetching eigen...")
FetchContent_Declare(
eigen
GIT_REPOSITORY https://gitlab.com/libeigen/eigen.git
GIT_TAG 3.4.0
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE)
option(EIGEN_BUILD_DOC OFF)
option(BUILD_TESTING OFF)
option(EIGEN_LEAVE_TEST_IN_ALL_TARGET OFF)
option(EIGEN_BUILD_PKGCONFIG OFF)
FetchContent_MakeAvailable(eigen)
include(ExternalProject)
ExternalProject_Add(cppad
GIT_REPOSITORY https://github.com/coin-or/CppAD.git
GIT_TAG 20210000.8
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
CMAKE_CACHE_ARGS -Dcppad_prefix:STRING=${CMAKE_BINARY_DIR}/cppad
)
ExternalProject_Add(cppadcodgen
GIT_REPOSITORY https://github.com/joaoleal/CppADCodeGen.git
GIT_TAG v2.4.3
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
CMAKE_CACHE_ARGS -DCPPAD_HOME:STRING=${CMAKE_BINARY_DIR}/cppad/include -DGOOGLETEST_GIT:BOOL=ON -DCMAKE_INSTALL_PREFIX:STRING=${CMAKE_BINARY_DIR}/cppadcodegen
DEPENDS cppad
)
I used the following commands to test it:
mkdir cmake-build
cd !$
cmake ..
cmake --build .
Explanation
Most of the parameters are exactly the same as used in FetchContent. The only differences are:
We install cppad to the build directory instead of a system wide directory, so the whole process will be self-contained. It is achieved by setting the cppad_prefix cache variable to ${CMAKE_BINARY_DIR}/cppad in the CMAKE_CACHE_ARGS option.
We make sure that cppadcodgen succeeds finding CppAD by setting the CPPAD_HOME cache variable to the include directory (which is ${CMAKE_BINARY_DIR}/cppad/include) and also setting this target to run after CppAD is installed using the DEPENDS option.
cppadcodgen sets the test targets as well and it will fail if it cannot find Google Test. Fortunately they provide an option to download Google Test using the GOOGLETEST_GIT option which we set to ON.
Finally, we set to install cppadcodgen inside the build directory, by setting CMAKE_INSTALL_PREFIX variable.
Note that I haven't touched eigen because I don't know what would be the exact usage and it didn't fail the build. It could be easily modified to be ExternalProject as written above if needed.
More information on ExternalProject can be found in Cmake's documentation.
Consuming the Dependencies
In order to consume the dependencies we have to perform some modifications.
Let's take as example the main file from CppADCodeGen wiki page and try to compile it with our solution:
main.cpp
#include <iosfwd>
#include <vector>
#include <cppad/cg.hpp>
using namespace CppAD;
using namespace CppAD::cg;
int main() {
// use a special object for source code generation
typedef CG<double> CGD;
typedef AD<CGD> ADCG;
/***************************************************************************
* the model
**************************************************************************/
// independent variable vector
CppAD::vector<ADCG> x(2);
x[0] = 2.;
x[1] = 3.;
Independent(x);
// dependent variable vector
CppAD::vector<ADCG> y(1);
// the model
ADCG a = x[0] / 1. + x[1] * x[1];
y[0] = a / 2;
ADFun<CGD> fun(x, y); // the model tape
/***************************************************************************
* Generate the C source code
**************************************************************************/
/**
* start the special steps for source code generation for a Jacobian
*/
CodeHandler<double> handler;
CppAD::vector<CGD> indVars(2);
handler.makeVariables(indVars);
CppAD::vector<CGD> jac = fun.SparseJacobian(indVars);
LanguageC<double> langC("double");
LangCDefaultVariableNameGenerator<double> nameGen;
std::ostringstream code;
handler.generateCode(code, langC, jac, nameGen);
std::cout << code.str();
}
Note that ExternalProject_Add command runs on build time, and we would like to find our dependencies already during Cmake reload time. So unfortunately we'll have to do a dirty trick to force ExternalProject_Add to run on Cmake reload time:
We'll move the ExternalProject_Add commands into a helper, CMakeLists.txt.in file.
We'll configure the CMakeLists.txt.in so the output paths of the libraries will remain inside our build directory.
We'll invoke execute_process (which run on cmake reload time) to execute the build process of the helper CMakeLists.txt.in
We'll find our libraries and consume them. Note that we can't use the modern Cmake targets syntax, as the whole process is being run in a sub-process and we don't have access to the created target. But even if we didn't run it inside a sub process, ExternalProject targets' type is utility which can't be used in commands such as target_link_libraries. So we'll use the custom paths we created for the dependencies and pass them to target_link_libraries and target_include_directories commands.
The end results are displayed below:
CMakeLists.txt.in
cmake_minimum_required(VERSION 2.8)
project(deps-download NONE)
include(ExternalProject)
ExternalProject_Add(cppad
GIT_REPOSITORY https://github.com/coin-or/CppAD.git
GIT_TAG 20210000.8
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
CMAKE_CACHE_ARGS -Dcppad_prefix:STRING=${CMAKE_BINARY_DIR}/cppad
)
ExternalProject_Add(cppadcodgen
GIT_REPOSITORY https://github.com/joaoleal/CppADCodeGen.git
GIT_TAG v2.4.3
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
CMAKE_CACHE_ARGS -DCPPAD_HOME:STRING=${CMAKE_BINARY_DIR}/cppad/include -DGOOGLETEST_GIT:BOOL=ON -DCMAKE_INSTALL_PREFIX:STRING=${CMAKE_BINARY_DIR}/cppadcodegen
DEPENDS cppad
)
CMakeLists.txt
include(FetchContent)
message(STATUS "Fetching eigen...")
FetchContent_Declare(
eigen
GIT_REPOSITORY https://gitlab.com/libeigen/eigen.git
GIT_TAG 3.4.0
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE)
option(EIGEN_BUILD_DOC OFF)
option(BUILD_TESTING OFF)
option(EIGEN_LEAVE_TEST_IN_ALL_TARGET OFF)
option(EIGEN_BUILD_PKGCONFIG OFF)
FetchContent_MakeAvailable(eigen)
# Configure the helper CMakeLists with the dependencies
configure_file(CMakeLists.txt.in ${CMAKE_BINARY_DIR}/deps-build/CMakeLists.txt)
# Build it
execute_process(COMMAND ${CMAKE_COMMAND} .
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/deps-build)
execute_process(COMMAND ${CMAKE_COMMAND} --build .
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/deps-build)
# Find cppad_lib's path
find_library(cppad_lib cppad_lib HINTS ${CMAKE_BINARY_DIR}/cppad/lib REQUIRED)
# Create our target
add_executable(main
main.cpp)
target_link_libraries(main ${cppad_lib})
target_include_directories(main PUBLIC
${CMAKE_BINARY_DIR}/cppad/include
${CMAKE_BINARY_DIR}/cppadcodegen/include)
As before, I used the following commands to test it:
mkdir cmake-build
cd !$
cmake ..
cmake --build .
./main
The solution is based on this post.

Related

error with Install OpenCV C++ and Set It Up in Visual Studio Code with CMake

I intend to work with OpenCV C++ code with VScode in Windows 11
my VSCode compiler and make tools properly installed and work
I use the following CMake file to debug my simple code, however, it can not detect the header library even manually set the header path in c_cpp_properties.json file
my code
cmake_minimum_required(VERSION 3.0.0)
project(myopencv VERSION 0.1.0)
include(CTest)
enable_testing()
find_package(OpenCV REQUIRED)
include_directories($(OpenCV_DIR\include\opencv2))
include_directories($(OpenCV_DIR\x64\vc16\lib))
add_executable(myopencv main.cpp)
target_link_libraries(myopencv $OPENCV_LIBS)
#INCLUDE_DIRECTORIES($(OpenCV_DIR\x64\vc16\lib))
#add_library(OPENCV_LIBS $(OpenCV_DIR\x64\vc16\lib))
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)
those are screenshots of the problem
[main] Configuring folder: opencv2
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:FILEPATH=C:\cygwin64\bin\x86_64-pc-cygwin-gcc.exe -DCMAKE_CXX_COMPILER:FILEPATH=C:\cygwin64\bin\x86_64-pc-cygwin-g++.exe -Sc:/Users/Mehrdad/Documents/PlatformIO/Projects/opencv2 -Bc:/Users/Mehrdad/Documents/PlatformIO/Projects/opencv2/build -G "Unix Makefiles"
[cmake] Not searching for unused variables given on the command line.
[cmake] -- The C compiler identification is GNU 10.2.0
[cmake] -- The CXX compiler identification is GNU 10.2.0
[cmake] -- Detecting C compiler ABI info
[cmake] -- Detecting C compiler ABI info - failed
[cmake] -- Check for working C compiler: C:/cygwin64/bin/x86_64-pc-cygwin-gcc.exe
[cmake] -- Check for working C compiler: C:/cygwin64/bin/x86_64-pc-cygwin-gcc.exe - broken
[cmake] CMake Error at C:/Program Files/CMake/share/cmake-3.18/Modules/CMakeTestCCompiler.cmake:66 (message):
[cmake] The C compiler
[cmake]
[cmake] "C:/cygwin64/bin/x86_64-pc-cygwin-gcc.exe"
[cmake]
[cmake] is not able to compile a simple test program.
[cmake]
[cmake] It fails with the following output:
[cmake]
[cmake] Change Dir: C:/Users/Mehrdad/Documents/PlatformIO/Projects/opencv2/build/CMakeFiles/CMakeTmp
[cmake]
[cmake] Run Build Command(s):C:/cygwin64/bin/make.exe cmTC_9053f/fast && /usr/bin/make -f CMakeFiles/cmTC_9053f.dir/build.make CMakeFiles/cmTC_9053f.dir/build
[cmake] make[1]: Entering directory '/cygdrive/c/Users/Mehrdad/Documents/PlatformIO/Projects/opencv2/build/CMakeFiles/CMakeTmp'
[cmake] Building C object CMakeFiles/cmTC_9053f.dir/testCCompiler.c.obj
[cmake] C:/cygwin64/bin/x86_64-pc-cygwin-gcc.exe -o CMakeFiles/cmTC_9053f.dir/testCCompiler.c.obj -c C:/Users/Mehrdad/Documents/PlatformIO/Projects/opencv2/build/CMakeFiles/CMakeTmp/testCCompiler.c
[cmake] Linking C executable cmTC_9053f.exe
[cmake] "C:/Program Files/CMake/bin/cmake.exe" -E rm -f CMakeFiles/cmTC_9053f.dir/objects.a
[cmake] CMAKE_AR-NOTFOUND cr CMakeFiles/cmTC_9053f.dir/objects.a #CMakeFiles/cmTC_9053f.dir/objects1.rsp
[cmake] make[1]: CMAKE_AR-NOTFOUND: No such file or directory
[cmake] make[1]: *** [CMakeFiles/cmTC_9053f.dir/build.make:107: cmTC_9053f.exe] Error 127
[cmake] make[1]: Leaving directory '/cygdrive/c/Users/Mehrdad/Documents/PlatformIO/Projects/opencv2/build/CMakeFiles/CMakeTmp'
[cmake] -- Configuring incomplete, errors occurred!
[cmake] See also "C:/Users/Mehrdad/Documents/PlatformIO/Projects/opencv2/build/CMakeFiles/CMakeOutput.log".
[cmake] See also "C:/Users/Mehrdad/Documents/PlatformIO/Projects/opencv2/build/CMakeFiles/CMakeError.log".
[cmake] make: *** [Makefile:140: cmTC_9053f/fast] Error 2
[cmake]
[cmake]
[cmake]
[cmake]
[cmake]
[cmake] CMake will not be able to correctly generate this project.
[cmake] Call Stack (most recent call first):
[cmake] CMakeLists.txt:2 (project)
[cmake]
[cmake]
[proc] The command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:FILEPATH=C:\cygwin64\bin\x86_64-pc-cygwin-gcc.exe -DCMAKE_CXX_COMPILER:FILEPATH=C:\cygwin64\bin\x86_64-pc-cygwin-g++.exe -Sc:/Users/Mehrdad/Documents/PlatformIO/Projects/opencv2 -Bc:/Users/Mehrdad/Documents/PlatformIO/Projects/opencv2/build -G "Unix Makefiles" exited with code: 1 and signal: null

CMake error in FindTerminfo with clang-15 on MacOS

I'm using llvm in my project and find it with cmake's find_package(LLVM REQUIRED CONFIG).
Configuration fails with message:
[cmake] CMake Error at /Applications/CMake.app/Contents/share/cmake-3.23/Modules/Internal/CheckSourceCompiles.cmake:44 (message):
[cmake] check_source_compiles: C: needs to be enabled before use.
[cmake] Call Stack (most recent call first):
[cmake] /Applications/CMake.app/Contents/share/cmake-3.23/Modules/CheckCSourceCompiles.cmake:76 (cmake_check_source_compiles)
[cmake] /usr/local/lib/cmake/llvm/FindTerminfo.cmake:21 (check_c_source_compiles)
[cmake] /usr/local/lib/cmake/llvm/LLVMConfig.cmake:242 (find_package)
[cmake] tools/driver/CMakeLists.txt:6 (find_package)
[cmake]
[cmake]
[cmake] -- Could NOT find Terminfo (missing: Terminfo_LINKABLE)
[cmake] -- Configuring incomplete, errors occurred!
How to fix it?
It's actually a well-known issue in clang-14 and greater.
Temporary solution is to use C language in your project.
project(test LANGUAGES C CXX) # instead of project(test LANGUAGES CXX)

Trying to build Assimp as a submodule in Cmake it can't find zlib

I am building zlib & assimp as submodules for my project. Assimp fails to build after Zlib successfully compiles saying it can't find zlib.h
This is how I'm building my current submodule directory. Zlib.h seems to be a built as part of the zlib build. So I'm not sure how to get the other projects to recognize where the zlib header is.
add_subdirectory(zlib)
add_subdirectory(glad)
add_subdirectory(sdl2)
add_subdirectory(spdlog)
add_subdirectory(yamlcpp)
add_subdirectory(assimp)
add_subdirectory(nlohmann_json ${CMAKE_CURRENT_BINARY_DIR}/nlohmann_json)
#Find system packages to link
find_package(OpenGL COMPONENTS OpenGL REQUIRED)
set(GLM_PATH ${CMAKE_CURRENT_SOURCE_DIR}/glm)
add_library(glm INTERFACE)
target_include_directories(glm INTERFACE ${GLM_PATH})
set(ENTT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/entt/single_include)
add_library(EnTT INTERFACE)
target_include_directories(EnTT INTERFACE ${ENTT_PATH})
set(IMGUI_PROJECT_NAME ImGui)
set(IMGUI_PATH ${CMAKE_CURRENT_SOURCE_DIR}/imgui)
file(GLOB IMGUI_SOURCES ${IMGUI_PATH}/*.cpp ${IMGUI_PATH}/backends/imgui_impl_sdl.cpp ${IMGUI_PATH}/backends/imgui_impl_opengl3.cpp)
add_library(${IMGUI_PROJECT_NAME} STATIC ${IMGUI_SOURCES})
target_include_directories(${IMGUI_PROJECT_NAME} PUBLIC ${IMGUI_PATH})
target_link_libraries(${IMGUI_PROJECT_NAME} PRIVATE OpenGL::GL SDL2 glad)
edit: CMake output
Configuring folder:
KEngine
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.exe" --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -Hc:/Dev/KEngine -Bc:/Dev/KEngine/build -G "Visual Studio 16 2019" -T host=x64 -A x64
[cmake] Not searching for unused variables given on the command line.
[cmake] -- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19043.
[cmake] CMake Deprecation Warning at modules/zlib/CMakeLists.txt:1 (cmake_minimum_required):
[cmake] Compatibility with CMake < 2.8.12 will be removed from a future version of
[cmake] CMake.
[cmake]
[cmake] Update the VERSION argument <min> value or use a ...<max> suffix to tell
[cmake] CMake that the project does not need compatibility with older versions.
[cmake]
[cmake]
[cmake] -- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
[cmake] Reason given by package: The command
[cmake] "C:/msys64/mingw64/bin/pkg-config.exe" --version
[cmake] failed with output:
[cmake]
[cmake] stderr:
[cmake]
[cmake] result:
[cmake] The system cannot find the file specified
[cmake]
[cmake] --
[cmake] -- SDL2 was configured with the following options:
[cmake] --
[cmake] -- Platform: Windows-10.0.19043
[cmake] -- 64-bit: TRUE
[cmake] -- Compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe
[cmake] -- Revision: https://github.com/DeveloperChaseLewis/KEngine.git#63f74969dc82247490ac24bf4994c60e35370330
[cmake] --
[cmake] -- Subsystems:
[cmake] -- Atomic: ON
[cmake] -- Audio: ON
[cmake] -- Video: ON
[cmake] -- Render: ON
[cmake] -- Events: ON
[cmake] -- Joystick: ON
[cmake] -- Haptic: ON
[cmake] -- Power: ON
[cmake] -- Threads: ON
[cmake] -- Timers: ON
[cmake] -- File: ON
[cmake] -- Loadso: ON
[cmake] -- CPUinfo: ON
[cmake] -- Filesystem: ON
[cmake] -- Dlopen: ON
[cmake] -- Sensor: ON
[cmake] -- Locale: ON
[cmake] --
[cmake] -- Options:
[cmake] -- SDL_3DNOW (Wanted: ON): OFF
[cmake] -- SDL_ALSA (Wanted: OFF): OFF
[cmake] -- SDL_ALSA_SHARED (Wanted: OFF): OFF
[cmake] -- SDL_ALTIVEC (Wanted: ON): OFF
[cmake] -- SDL_ARMNEON (Wanted: OFF): OFF
[cmake] -- SDL_ARMSIMD (Wanted: OFF): OFF
[cmake] -- SDL_ARTS (Wanted: OFF): OFF
[cmake] -- SDL_ARTS_SHARED (Wanted: OFF): OFF
[cmake] -- SDL_ASAN (Wanted: OFF): OFF
[cmake] -- SDL_ASSEMBLY (Wanted: ON): OFF
[cmake] -- SDL_ASSERTIONS (Wanted: auto): auto
[cmake] -- SDL_BACKGROUNDING_SIGNAL (Wanted: OFF): OFF
[cmake] -- SDL_CLOCK_GETTIME (Wanted: OFF): OFF
[cmake] -- SDL_COCOA (Wanted: OFF): OFF
[cmake] -- SDL_DIRECTFB (Wanted: OFF): OFF
[cmake] -- SDL_DIRECTFB_SHARED (Wanted: OFF): OFF
[cmake] -- SDL_DIRECTX (Wanted: ON): ON
[cmake] -- SDL_DISKAUDIO (Wanted: ON): ON
[cmake] -- SDL_DUMMYAUDIO (Wanted: ON): ON
[cmake] -- SDL_DUMMYVIDEO (Wanted: ON): OFF
[cmake] -- SDL_ESD (Wanted: OFF): OFF
[cmake] -- SDL_ESD_SHARED (Wanted: OFF): OFF
[cmake] -- SDL_FOREGROUNDING_SIGNAL (Wanted: OFF): OFF
[cmake] -- SDL_FUSIONSOUND (Wanted: OFF): OFF
[cmake] -- SDL_FUSIONSOUND_SHARED (Wanted: OFF): OFF
[cmake] -- SDL_GCC_ATOMICS (Wanted: OFF): OFF
[cmake] -- SDL_HIDAPI (Wanted: ON): ON
[cmake] -- SDL_JACK (Wanted: OFF): OFF
[cmake] -- SDL_JACK_SHARED (Wanted: OFF): OFF
[cmake] -- SDL_KMSDRM (Wanted: OFF): OFF
[cmake] -- SDL_KMSDRM_SHARED (Wanted: OFF): OFF
[cmake] -- SDL_LIBC (Wanted: OFF): OFF
[cmake] -- SDL_LIBSAMPLERATE (Wanted: OFF): OFF
[cmake] -- SDL_LIBSAMPLERATE_SHARED (Wanted: OFF): OFF
[cmake] -- SDL_METAL (Wanted: OFF): OFF
[cmake] -- SDL_MMX (Wanted: ON): OFF
[cmake] -- SDL_NAS (Wanted: OFF): OFF
[cmake] -- SDL_NAS_SHARED (Wanted: OFF): OFF
[cmake] -- SDL_OFFSCREEN (Wanted: OFF): OFF
[cmake] -- SDL_OPENGL (Wanted: ON): ON
[cmake] -- SDL_OPENGLES (Wanted: ON): ON
[cmake] -- SDL_OSS (Wanted: OFF): OFF
[cmake] -- SDL_PIPEWIRE (Wanted: OFF): OFF
[cmake] -- SDL_PIPEWIRE_SHARED (Wanted: OFF): OFF
[cmake] -- SDL_PTHREADS (Wanted: OFF): OFF
[cmake] -- SDL_PTHREADS_SEM (Wanted: OFF): OFF
[cmake] -- SDL_PULSEAUDIO (Wanted: OFF): OFF
[cmake] -- SDL_PULSEAUDIO_SHARED (Wanted: OFF): OFF
[cmake] -- SDL_RENDER_D3D (Wanted: ON): ON
[cmake] -- SDL_RENDER_METAL (Wanted: OFF): OFF
[cmake] -- SDL_RPATH (Wanted: OFF): OFF
[cmake] -- SDL_RPI (Wanted: OFF): OFF
[cmake] -- SDL_SNDIO (Wanted: OFF): OFF
[cmake] -- SDL_SNDIO_SHARED (Wanted: OFF): OFF
[cmake] -- SDL_SSE (Wanted: ON): ON
[cmake] -- SDL_SSE2 (Wanted: ON): ON
[cmake] -- SDL_SSE3 (Wanted: ON): ON
[cmake] -- SDL_SSEMATH (Wanted: ON): OFF
[cmake] -- SDL_STATIC_PIC (Wanted: OFF): OFF
[cmake] -- SDL_TEST (Wanted: OFF): OFF
[cmake] -- SDL_VIRTUAL_JOYSTICK (Wanted: ON): ON
[cmake] -- SDL_VIVANTE (Wanted: OFF): OFF
[cmake] -- SDL_VULKAN (Wanted: ON): ON
[cmake] -- SDL_WASAPI (Wanted: ON): OFF
[cmake] -- SDL_WAYLAND (Wanted: OFF): OFF
[cmake] -- SDL_WAYLAND_LIBDECOR (Wanted: ON): OFF
[cmake] -- SDL_WAYLAND_LIBDECOR_SHARED (Wanted: ON): OFF
[cmake] -- SDL_WAYLAND_QT_TOUCH (Wanted: OFF): OFF
[cmake] -- SDL_WAYLAND_SHARED (Wanted: OFF): OFF
[cmake] -- SDL_X11 (Wanted: OFF): OFF
[cmake] -- SDL_X11_SHARED (Wanted: OFF): OFF
[cmake] -- SDL_X11_XCURSOR (Wanted: OFF): OFF
[cmake] -- SDL_X11_XINERAMA (Wanted: OFF): OFF
[cmake] -- SDL_X11_XINPUT (Wanted: OFF): OFF
[cmake] -- SDL_X11_XRANDR (Wanted: OFF): OFF
[cmake] -- SDL_X11_XSCRNSAVER (Wanted: OFF): OFF
[cmake] -- SDL_X11_XSHAPE (Wanted: OFF): OFF
[cmake] -- SDL_X11_XVM (Wanted: OFF): OFF
[cmake] -- SDL_XINPUT (Wanted: ON): OFF
[cmake] --
[cmake] -- CMAKE_C_FLAGS_DEBUG: /MDd /Zi /Ob0 /Od
[cmake] -- CMAKE_CXX_FLAGS_DEBUG: /MDd /Zi /Ob0 /Od /RTC1
[cmake] --
[cmake] -- CFLAGS: /DWIN32 /D_WINDOWS /W3 "-IC:/Dev/KEngine/modules/sdl2/src/hidapi/hidapi"
[cmake] -- EXTRA_CFLAGS:
[cmake] -- EXTRA_LDFLAGS:
[cmake] -- EXTRA_LIBS: user32;gdi32;winmm;imm32;ole32;oleaut32;version;uuid;advapi32;setupapi;shell32;dinput8
[cmake] --
[cmake] -- Build Shared Library: ON
[cmake] -- Build Static Library: ON
[cmake] -- Build Static Library with Position Independent Code: OFF
[cmake] --
[cmake] -- Build spdlog: 1.9.2
[cmake] -- Build type: Debug
[cmake] -- Shared libraries enabled
[cmake] -- Looking for ZLIB...
[cmake] -- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
[cmake] Reason given by package: The command
[cmake] "C:/msys64/mingw64/bin/pkg-config.exe" --version
[cmake] failed with output:
[cmake]
[cmake] stderr:
[cmake]
[cmake] result:
[cmake] The system cannot find the file specified
[cmake]
[cmake] -- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
[cmake] -- Enabled importer formats: AMF 3DS AC ASE ASSBIN B3D BVH COLLADA DXF CSM HMP IRRMESH IRR LWO LWS M3D MD2 MD3 MD5 MDC MDL NFF NDO OFF OBJ OGRE OPENGEX PLY MS3D COB BLEND IFC XGL FBX Q3D Q3BSP RAW SIB SMD STL TERRAGEN 3D X X3D GLTF 3MF MMD
[cmake] -- Disabled importer formats:
[cmake] -- Enabled exporter formats: OBJ OPENGEX PLY 3DS ASSBIN ASSXML M3D COLLADA FBX STL X X3D GLTF 3MF PBRT ASSJSON STEP
[cmake] -- Disabled exporter formats:
[cmake] -- Using the single-header code from C:/Dev/KEngine/modules/nlohmann_json/single_include/
[cmake] -- Configuring done
[cmake] -- Generating done
[cmake] -- Build files have been written to: C:/Dev/KEngine/build
[main] Building folder: KEngine SANDBOX
[build] Starting build
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.exe" --build c:/Dev/KEngine/build --config Debug --target SANDBOX -j 18 --
[build] Microsoft (R) Build Engine version 16.11.0+0538acc04 for .NET Framework
[build] Copyright (C) Microsoft Corporation. All rights reserved.
[build]
[build] Checking File Globs
[build] spdlog.vcxproj -> C:\Dev\KEngine\build\bin\spdlogd.dll
[build] zlib.vcxproj -> C:\Dev\KEngine\build\bin\zlibd1.dll
[build] yaml-cpp.vcxproj -> C:\Dev\KEngine\build\lib\yaml-cppd.lib
[build] glad.vcxproj -> C:\Dev\KEngine\build\bin\gladd.dll
[build] SDL2.vcxproj -> C:\Dev\KEngine\build\bin\SDL2d.dll
[build] ImGui.vcxproj -> C:\Dev\KEngine\build\lib\ImGuid.lib
[build] ZipArchiveIOSystem.cpp
[build] C:\Dev\KEngine\modules\assimp\contrib\unzip\unzip.h(25,10): fatal error C1083: Cannot open include file: 'zlib.h': No such file or directory [C:\Dev\KEngine\build\modules\assimp\code\assimp.vcxproj]
[build] AssbinLoader.cpp
[build] C:\Dev\KEngine\modules\assimp\code\AssetLib\Assbin\AssbinLoader.cpp(61,10): fatal error C1083: Cannot open include file: 'zlib.h': No such file or directory [C:\Dev\KEngine\build\modules\assimp\code\assimp.vcxproj]
[build] BlenderLoader.cpp
[build] C:\Dev\KEngine\modules\assimp\code\AssetLib\Blender\BlenderLoader.cpp(70,14): fatal error C1083: Cannot open include file: 'zlib.h': No such file or directory [C:\Dev\KEngine\build\modules\assimp\code\assimp.vcxproj]
[build] IFCLoader.cpp
[build] C:\Dev\KEngine\modules\assimp\contrib\unzip\unzip.h(25,10): fatal error C1083: Cannot open include file: 'zlib.h': No such file or directory [C:\Dev\KEngine\build\modules\assimp\code\assimp.vcxproj]
[build] XGLLoader.cpp
[build] C:\Dev\KEngine\modules\assimp\code\AssetLib\XGL\XGLLoader.cpp(63,14): fatal error C1083: Cannot open include file: 'zlib.h': No such file or directory [C:\Dev\KEngine\build\modules\assimp\code\assimp.vcxproj]
[build] FBXParser.cpp
[build] C:\Dev\KEngine\modules\assimp\code\AssetLib\FBX\FBXParser.cpp(50,13): fatal error C1083: Cannot open include file: 'zlib.h': No such file or directory [C:\Dev\KEngine\build\modules\assimp\code\assimp.vcxproj]
[build] Q3BSPFileImporter.cpp
[build] C:\Dev\KEngine\modules\assimp\code\AssetLib\Q3BSP\Q3BSPFileImporter.cpp(52,10): fatal error C1083: Cannot open include file: 'zlib.h': No such file or directory [C:\Dev\KEngine\build\modules\assimp\code\assimp.vcxproj]
[build] XFileParser.cpp
[build] C:\Dev\KEngine\modules\assimp\code\AssetLib\X\XFileParser.cpp(64,10): fatal error C1083: Cannot open include file: 'zlib.h': No such file or directory [C:\Dev\KEngine\build\modules\assimp\code\assimp.vcxproj]
[build] AssbinFileWriter.cpp
[build] C:\Dev\KEngine\modules\assimp\code\AssetLib\Assbin\AssbinFileWriter.cpp(54,10): fatal error C1083: Cannot open include file: 'zlib.h': No such file or directory [C:\Dev\KEngine\build\modules\assimp\code\assimp.vcxproj]
[build] AssxmlFileWriter.cpp
[build] C:\Dev\KEngine\modules\assimp\code\AssetLib\Assxml\AssxmlFileWriter.cpp(59,10): fatal error C1083: Cannot open include file: 'zlib.h': No such file or directory [C:\Dev\KEngine\build\modules\assimp\code\assimp.vcxproj]
[build] Generating Code...
[build] Build finished with exit code 1
[main] Failed to prepare executable target with name 'undefined'

Setting Ninja values through CMake (cross compilation)

I am currently trying to cross compile a program I wrote on macOS to Linux, and I have had to make some changes to the build.ninja file to make that possible (specifically the linker commands/other places where libraries are linked). However, this gets wiped when I reconfigure CMake. Is there a way that I could use CMake to set the values in my Ninja file instead of wherever they are being set from? I am also using vcpkg for this project with GCC 10.2.0 for x86_64 Linux. The ninja files had to be trimmed to fit under the character limit, I can find a different way to put up the complete ones if needed. Here are my current CMakeLists, the first being my top level one and the second being the one that links everything:
Removed to make room for edits, working file can be found in edit 2
# CMakeList.txt : CMake project for ImpromptuServer, include source and define
# project specific logic here.
#
cmake_minimum_required(VERSION 3.8)
add_subdirectory("database")
add_subdirectory("web")
add_subdirectory("api")
add_subdirectory("utils")
# Add source to this project's executable.
file(GLOB_RECURSE web ./web/*.cpp ./web/*.hpp)
file(GLOB_RECURSE database ./database/*.cpp ./datbase/*.hpp)
file(GLOB_RECURSE api ./api/*.cpp ./api/*.hpp)
add_library(libweb ${web})
add_library(libdata ${database})
add_library(libapi ${api})
add_executable(ImpromptuServer "ImpromptuServer.cpp" ${web} ${database} ${api})
set(ALL_LIBS Wt::Wt Wt::Dbo Wt::HTTP Wt::DboSqlite3 cryptopp-static json11 OpenSSL::SSL OpenSSL::Crypto cpr)
# TODO: Add tests and install targets if needed.
target_link_libraries(ImpromptuServer PRIVATE ${ALL_LIBS})
target_link_libraries(libweb PRIVATE Wt::Wt Wt::Dbo Wt::HTTP Wt::DboSqlite3)
target_link_libraries(libdata PRIVATE Wt::Wt Wt::Dbo Wt::HTTP Wt::DboSqlite3)
target_link_libraries(libapi PRIVATE ${ALL_LIBS})
I know GLOB_RECURSE is not best practice, but I don't want to change it unless it will fix my problem. Here is my original build.ninja file:
REMOVED due to irrelevancy to question.
Here is the one that I modified to get working:
REMOVED due to irrelevancy to question.
However, even when I compile successfully with the modified ninja file, I get this output message and the code fails to run on a Linux machine:
/Volumes/CaseSensitive/cross/lib/gcc/x86_64-linux/10.2.0/../../../../x86_64-linux/bin/ld: warning: cannot find entry symbol arch_paths_first; defaulting to 0000000000414000
The code runs fine when compiling for macOS and using the original build.ninja file.
Edit 1
After a lot of work, I have gotten CMake to use the toolchain file, but I still have a lingering problem where CMake can't find Threads::Threads. Here is my current CMakeLists.txt:
Working file can be found in edit 2
Here is the output message that I get:
[main] Configuring folder: ImpromptuServer
[cmake] -- Found OpenSSL: /usr/lib/libcrypto.dylib
[cmake] -- Found ZLIB: /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/lib/libz.tbd (found version "1.2.11")
[cmake] -- Found CURL: /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/lib/libcurl.tbd (found version "7.64.1")
[cmake] -- Configuring done
[cmake] CMake Error at /Volumes/CaseSensitive/vcpkgLinux/scripts/buildsystems/vcpkg.cmake:331 (_add_executable):
[cmake] Target "ImpromptuServer" links to target "Threads::Threads" but the target
[cmake] was not found. Perhaps a find_package() call is missing for an IMPORTED
[cmake] target, or an ALIAS target is missing?
[cmake] Call Stack (most recent call first):
[cmake] ImpromptuServer/CMakeLists.txt:20 (add_executable)
[cmake]
[cmake]
[cmake] CMake Error at /Volumes/CaseSensitive/vcpkgLinux/scripts/buildsystems/vcpkg.cmake:331 (_add_executable):
[cmake] Target "ImpromptuServer" links to target "Threads::Threads" but the target
[cmake] was not found. Perhaps a find_package() call is missing for an IMPORTED
[cmake] target, or an ALIAS target is missing?
[cmake] Call Stack (most recent call first):
[cmake] ImpromptuServer/CMakeLists.txt:20 (add_executable)
[cmake]
[cmake]
[cmake] CMake Error at /Volumes/CaseSensitive/vcpkgLinux/scripts/buildsystems/vcpkg.cmake:331 (_add_executable):
[cmake] Target "ImpromptuServer" links to target "Threads::Threads" but the target
[cmake] was not found. Perhaps a find_package() call is missing for an IMPORTED
[cmake] target, or an ALIAS target is missing?
[cmake] Call Stack (most recent call first):
[cmake] ImpromptuServer/CMakeLists.txt:20 (add_executable)
[cmake]
[cmake]
[cmake] CMake Error at /Volumes/CaseSensitive/vcpkgLinux/scripts/buildsystems/vcpkg.cmake:331 (_add_executable):
[cmake] Target "ImpromptuServer" links to target "Threads::Threads" but the target
[cmake] was not found. Perhaps a find_package() call is missing for an IMPORTED
[cmake] target, or an ALIAS target is missing?
[cmake] Call Stack (most recent call first):
[cmake] ImpromptuServer/CMakeLists.txt:20 (add_executable)
[cmake]
[cmake]
[cmake] CMake Error at /Volumes/CaseSensitive/vcpkgLinux/scripts/buildsystems/vcpkg.cmake:360 (_add_library):
[cmake] Target "libapi" links to target "Threads::Threads" but the target was not
[cmake] found. Perhaps a find_package() call is missing for an IMPORTED target, or
[cmake] an ALIAS target is missing?
[cmake] Call Stack (most recent call first):
[cmake] ImpromptuServer/CMakeLists.txt:18 (add_library)
[cmake]
[cmake]
[cmake] CMake Error at /Volumes/CaseSensitive/vcpkgLinux/scripts/buildsystems/vcpkg.cmake:360 (_add_library):
[cmake] Target "libapi" links to target "Threads::Threads" but the target was not
[cmake] found. Perhaps a find_package() call is missing for an IMPORTED target, or
[cmake] an ALIAS target is missing?
[cmake] Call Stack (most recent call first):
[cmake] ImpromptuServer/CMakeLists.txt:18 (add_library)
[cmake]
[cmake]
[cmake] CMake Error at /Volumes/CaseSensitive/vcpkgLinux/scripts/buildsystems/vcpkg.cmake:360 (_add_library):
[cmake] Target "libapi" links to target "Threads::Threads" but the target was not
[cmake] found. Perhaps a find_package() call is missing for an IMPORTED target, or
[cmake] an ALIAS target is missing?
[cmake] Call Stack (most recent call first):
[cmake] ImpromptuServer/CMakeLists.txt:18 (add_library)
[cmake]
[cmake]
[cmake] CMake Error at /Volumes/CaseSensitive/vcpkgLinux/scripts/buildsystems/vcpkg.cmake:360 (_add_library):
[cmake] Target "libapi" links to target "Threads::Threads" but the target was not
[cmake] found. Perhaps a find_package() call is missing for an IMPORTED target, or
[cmake] an ALIAS target is missing?
[cmake] Call Stack (most recent call first):
[cmake] ImpromptuServer/CMakeLists.txt:18 (add_library)
[cmake]
[cmake]
[cmake] CMake Error at /Volumes/CaseSensitive/vcpkgLinux/scripts/buildsystems/vcpkg.cmake:360 (_add_library):
[cmake] Target "libdata" links to target "Threads::Threads" but the target was not
[cmake] found. Perhaps a find_package() call is missing for an IMPORTED target, or
[cmake] an ALIAS target is missing?
[cmake] Call Stack (most recent call first):
[cmake] ImpromptuServer/CMakeLists.txt:17 (add_library)
[cmake]
[cmake]
[cmake] CMake Error at /Volumes/CaseSensitive/vcpkgLinux/scripts/buildsystems/vcpkg.cmake:360 (_add_library):
[cmake] Target "libdata" links to target "Threads::Threads" but the target was not
[cmake] found. Perhaps a find_package() call is missing for an IMPORTED target, or
[cmake] an ALIAS target is missing?
[cmake] Call Stack (most recent call first):
[cmake] ImpromptuServer/CMakeLists.txt:17 (add_library)
[cmake]
[cmake]
[cmake] CMake Error at /Volumes/CaseSensitive/vcpkgLinux/scripts/buildsystems/vcpkg.cmake:360 (_add_library):
[cmake] Target "libdata" links to target "Threads::Threads" but the target was not
[cmake] found. Perhaps a find_package() call is missing for an IMPORTED target, or
[cmake] an ALIAS target is missing?
[cmake] Call Stack (most recent call first):
[cmake] ImpromptuServer/CMakeLists.txt:17 (add_library)
[cmake]
[cmake]
[cmake] CMake Error at /Volumes/CaseSensitive/vcpkgLinux/scripts/buildsystems/vcpkg.cmake:360 (_add_library):
[cmake] Target "libdata" links to target "Threads::Threads" but the target was not
[cmake] found. Perhaps a find_package() call is missing for an IMPORTED target, or
[cmake] an ALIAS target is missing?
[cmake] Call Stack (most recent call first):
[cmake] ImpromptuServer/CMakeLists.txt:17 (add_library)
[cmake]
[cmake]
[cmake] CMake Error at /Volumes/CaseSensitive/vcpkgLinux/scripts/buildsystems/vcpkg.cmake:360 (_add_library):
[cmake] Target "libweb" links to target "Threads::Threads" but the target was not
[cmake] found. Perhaps a find_package() call is missing for an IMPORTED target, or
[cmake] an ALIAS target is missing?
[cmake] Call Stack (most recent call first):
[cmake] ImpromptuServer/CMakeLists.txt:16 (add_library)
[cmake]
[cmake]
[cmake] CMake Error at /Volumes/CaseSensitive/vcpkgLinux/scripts/buildsystems/vcpkg.cmake:360 (_add_library):
[cmake] Target "libweb" links to target "Threads::Threads" but the target was not
[cmake] found. Perhaps a find_package() call is missing for an IMPORTED target, or
[cmake] an ALIAS target is missing?
[cmake] Call Stack (most recent call first):
[cmake] ImpromptuServer/CMakeLists.txt:16 (add_library)
[cmake]
[cmake]
[cmake] CMake Error at /Volumes/CaseSensitive/vcpkgLinux/scripts/buildsystems/vcpkg.cmake:360 (_add_library):
[cmake] Target "libweb" links to target "Threads::Threads" but the target was not
[cmake] found. Perhaps a find_package() call is missing for an IMPORTED target, or
[cmake] an ALIAS target is missing?
[cmake] Call Stack (most recent call first):
[cmake] ImpromptuServer/CMakeLists.txt:16 (add_library)
[cmake]
[cmake]
[cmake] CMake Error at /Volumes/CaseSensitive/vcpkgLinux/scripts/buildsystems/vcpkg.cmake:360 (_add_library):
[cmake] Target "libweb" links to target "Threads::Threads" but the target was not
[cmake] found. Perhaps a find_package() call is missing for an IMPORTED target, or
[cmake] an ALIAS target is missing?
[cmake] Call Stack (most recent call first):
[cmake] ImpromptuServer/CMakeLists.txt:16 (add_library)
[cmake]
[cmake]
[cmake] -- Generating done
[cmake] CMake Generate step failed. Build files cannot be regenerated correctly.
[main] Configuring folder: ImpromptuServer
[proc] Executing command: /usr/local/bin/cmake --no-warn-unused-cli -DCMAKE_TOOLCHAIN_FILE=/Volumes/CaseSensitive/vcpkgLinux/scripts/buildsystems/vcpkg.cmake -DCMAKE_CROSSCOMPILING=True -Wno-dev -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:FILEPATH=/Volumes/CaseSensitive/cross/bin/x86_64-linux-gcc -DCMAKE_CXX_COMPILER:FILEPATH=/Volumes/CaseSensitive/cross/bin/x86_64-linux-g++ -H/Users/jackhogan/Desktop/Code/C++/ImpromptuServer -B/Users/jackhogan/Desktop/Code/C++/ImpromptuServer/build -G Ninja
[cmake] Not searching for unused variables given on the command line.
[cmake] INFO Using Linux protocols
[cmake] -- Configuring done
[cmake] CMake Error at /Volumes/CaseSensitive/vcpkgLinux/scripts/buildsystems/vcpkg.cmake:331 (_add_executable):
[cmake] Target "ImpromptuServer" links to target "Threads::Threads" but the target
[cmake] was not found. Perhaps a find_package() call is missing for an IMPORTED
[cmake] target, or an ALIAS target is missing?
[cmake] Call Stack (most recent call first):
[cmake] ImpromptuServer/CMakeLists.txt:20 (add_executable)
[cmake]
[cmake]
[cmake] CMake Error at /Volumes/CaseSensitive/vcpkgLinux/scripts/buildsystems/vcpkg.cmake:331 (_add_executable):
[cmake] Target "ImpromptuServer" links to target "Threads::Threads" but the target
[cmake] was not found. Perhaps a find_package() call is missing for an IMPORTED
[cmake] target, or an ALIAS target is missing?
[cmake] Call Stack (most recent call first):
[cmake] ImpromptuServer/CMakeLists.txt:20 (add_executable)
[cmake]
[cmake]
[cmake] CMake Error at /Volumes/CaseSensitive/vcpkgLinux/scripts/buildsystems/vcpkg.cmake:331 (_add_executable):
[cmake] Target "ImpromptuServer" links to target "Threads::Threads" but the target
[cmake] was not found. Perhaps a find_package() call is missing for an IMPORTED
[cmake] target, or an ALIAS target is missing?
[cmake] Call Stack (most recent call first):
[cmake] ImpromptuServer/CMakeLists.txt:20 (add_executable)
[cmake]
[cmake]
[cmake] CMake Error at /Volumes/CaseSensitive/vcpkgLinux/scripts/buildsystems/vcpkg.cmake:331 (_add_executable):
[cmake] Target "ImpromptuServer" links to target "Threads::Threads" but the target
[cmake] was not found. Perhaps a find_package() call is missing for an IMPORTED
[cmake] target, or an ALIAS target is missing?
[cmake] Call Stack (most recent call first):
[cmake] ImpromptuServer/CMakeLists.txt:20 (add_executable)
[cmake]
[cmake]
[cmake] CMake Error at /Volumes/CaseSensitive/vcpkgLinux/scripts/buildsystems/vcpkg.cmake:360 (_add_library):
[cmake] Target "libapi" links to target "Threads::Threads" but the target was not
[cmake] found. Perhaps a find_package() call is missing for an IMPORTED target, or
[cmake] an ALIAS target is missing?
[cmake] Call Stack (most recent call first):
[cmake] ImpromptuServer/CMakeLists.txt:18 (add_library)
[cmake]
[cmake]
[cmake] CMake Error at /Volumes/CaseSensitive/vcpkgLinux/scripts/buildsystems/vcpkg.cmake:360 (_add_library):
[cmake] Target "libapi" links to target "Threads::Threads" but the target was not
[cmake] found. Perhaps a find_package() call is missing for an IMPORTED target, or
[cmake] an ALIAS target is missing?
[cmake] Call Stack (most recent call first):
[cmake] ImpromptuServer/CMakeLists.txt:18 (add_library)
[cmake]
[cmake]
[cmake] CMake Error at /Volumes/CaseSensitive/vcpkgLinux/scripts/buildsystems/vcpkg.cmake:360 (_add_library):
[cmake] Target "libapi" links to target "Threads::Threads" but the target was not
[cmake] found. Perhaps a find_package() call is missing for an IMPORTED target, or
[cmake] an ALIAS target is missing?
[cmake] Call Stack (most recent call first):
[cmake] ImpromptuServer/CMakeLists.txt:18 (add_library)
[cmake]
[cmake]
[cmake] CMake Error at /Volumes/CaseSensitive/vcpkgLinux/scripts/buildsystems/vcpkg.cmake:360 (_add_library):
[cmake] Target "libapi" links to target "Threads::Threads" but the target was not
[cmake] found. Perhaps a find_package() call is missing for an IMPORTED target, or
[cmake] an ALIAS target is missing?
[cmake] Call Stack (most recent call first):
[cmake] ImpromptuServer/CMakeLists.txt:18 (add_library)
[cmake]
[cmake]
[cmake] CMake Error at /Volumes/CaseSensitive/vcpkgLinux/scripts/buildsystems/vcpkg.cmake:360 (_add_library):
[cmake] Target "libdata" links to target "Threads::Threads" but the target was not
[cmake] found. Perhaps a find_package() call is missing for an IMPORTED target, or
[cmake] an ALIAS target is missing?
[cmake] Call Stack (most recent call first):
[cmake] ImpromptuServer/CMakeLists.txt:17 (add_library)
[cmake]
[cmake]
[cmake] CMake Error at /Volumes/CaseSensitive/vcpkgLinux/scripts/buildsystems/vcpkg.cmake:360 (_add_library):
[cmake] Target "libdata" links to target "Threads::Threads" but the target was not
[cmake] found. Perhaps a find_package() call is missing for an IMPORTED target, or
[cmake] an ALIAS target is missing?
[cmake] Call Stack (most recent call first):
[cmake] ImpromptuServer/CMakeLists.txt:17 (add_library)
[cmake]
[cmake]
[cmake] CMake Error at /Volumes/CaseSensitive/vcpkgLinux/scripts/buildsystems/vcpkg.cmake:360 (_add_library):
[cmake] Target "libdata" links to target "Threads::Threads" but the target was not
[cmake] found. Perhaps a find_package() call is missing for an IMPORTED target, or
[cmake] an ALIAS target is missing?
[cmake] Call Stack (most recent call first):
[cmake] ImpromptuServer/CMakeLists.txt:17 (add_library)
[cmake]
[cmake]
[cmake] CMake Error at /Volumes/CaseSensitive/vcpkgLinux/scripts/buildsystems/vcpkg.cmake:360 (_add_library):
[cmake] Target "libdata" links to target "Threads::Threads" but the target was not
[cmake] found. Perhaps a find_package() call is missing for an IMPORTED target, or
[cmake] an ALIAS target is missing?
[cmake] Call Stack (most recent call first):
[cmake] ImpromptuServer/CMakeLists.txt:17 (add_library)
[cmake]
[cmake]
[cmake] CMake Error at /Volumes/CaseSensitive/vcpkgLinux/scripts/buildsystems/vcpkg.cmake:360 (_add_library):
[cmake] Target "libweb" links to target "Threads::Threads" but the target was not
[cmake] found. Perhaps a find_package() call is missing for an IMPORTED target, or
[cmake] an ALIAS target is missing?
[cmake] Call Stack (most recent call first):
[cmake] ImpromptuServer/CMakeLists.txt:16 (add_library)
[cmake]
[cmake]
[cmake] CMake Error at /Volumes/CaseSensitive/vcpkgLinux/scripts/buildsystems/vcpkg.cmake:360 (_add_library):
[cmake] Target "libweb" links to target "Threads::Threads" but the target was not
[cmake] found. Perhaps a find_package() call is missing for an IMPORTED target, or
[cmake] an ALIAS target is missing?
[cmake] Call Stack (most recent call first):
[cmake] ImpromptuServer/CMakeLists.txt:16 (add_library)
[cmake]
[cmake]
[cmake] CMake Error at /Volumes/CaseSensitive/vcpkgLinux/scripts/buildsystems/vcpkg.cmake:360 (_add_library):
[cmake] Target "libweb" links to target "Threads::Threads" but the target was not
[cmake] found. Perhaps a find_package() call is missing for an IMPORTED target, or
[cmake] an ALIAS target is missing?
[cmake] Call Stack (most recent call first):
[cmake] ImpromptuServer/CMakeLists.txt:16 (add_library)
[cmake]
[cmake]
[cmake] CMake Error at /Volumes/CaseSensitive/vcpkgLinux/scripts/buildsystems/vcpkg.cmake:360 (_add_library):
[cmake] Target "libweb" links to target "Threads::Threads" but the target was not
[cmake] found. Perhaps a find_package() call is missing for an IMPORTED target, or
[cmake] an ALIAS target is missing?
[cmake] Call Stack (most recent call first):
[cmake] ImpromptuServer/CMakeLists.txt:16 (add_library)
[cmake]
[cmake]
[cmake] -- Generating done
[cmake] CMake Generate step failed. Build files cannot be regenerated correctly.
Edit 2
Everything now configures correctly with this CMake file:
# CMakeList.txt : Top-level CMake project file, do global configuration
# and include sub-projects here.
#
cmake_minimum_required(VERSION 3.8)
project (ImpromptuServer C CXX)
if(${CMAKE_CXX_COMPILER_ID} STREQUAL AppleClang)
#set(CMAKE_TOOLCHAIN_FILE /Users/jackhogan/Desktop/Code/Utilities/vcpkg/scripts/buildsystems/vcpkg.cmake)
set(LIB_DIR /Users/jackhogan/Desktop/Code/Utilities/vcpkg/installed/x64-osx/debug/lib)
add_compile_options(-std=c++17)
find_package(threads REQUIRED)
else()
message(INFO " Using Linux protocols")
if(NOT ${CMAKE_TOOLCHAIN_FILE} STREQUAL /Volumes/CaseSensitive/vcpkgLinux/scripts/buildsystems/vcpkg.cmake)
message(FATAL_ERROR " Incorrect toolchain file")
endif()
add_compile_options(-std=gnu++17)
#set(CMAKE_TOOLCHAIN_FILE /Volumes/CaseSensitive/vcpkgLinux/scripts/buildsystems/vcpkg.cmake)
set(CMAKE_CROSSCOMPILING true)
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR x86_64)
set(LIB_DIR /Volumes/CaseSensitive/vcpkgLinux/installed/x64-linux/debug/lib)
set(CMAKE_FIND_ROOT_PATH /Volumes/CaseSensitive/vcpkgLinux/installed/x64-linux/debug/lib)
set(CMAKE_SYSROOT /Volumes/CaseSensitive/cross/x86_64-linux/)
# Find libraries, may be changed later
set(wt_DIR /Volumes/CaseSensitive/vcpkgLinux/installed/x64-linux/share/wt/)
set(OPENSSL_INCLUDE_DIR /Volumes/CaseSensitive/vcpkgLinux/installed/x64-linux/include/openssl)
set(OPENSSL_ROOT_DIR /Volumes/CaseSensitive/cross/x86_64-linux/lib/)
set(cryptopp_DIR /Volumes/CaseSensitive/vcpkgLinux/installed/x64-linux/share/cryptopp/)
set(cpr_DIR /Volumes/CaseSensitive/vcpkgLinux/installed/x64-linux/share/cpr/)
# Find pthread
set(CMAKE_THREAD_LIBS_INIT /Volumes/CaseSensitive/cross/x86_64-linux/lib/libpthread.a)
include_directories(/Volumes/CaseSensitive/cross/x86_64-linux/lib/)
include_directories(/Volumes/CaseSensitive/cross/x86_64-linux/lib64/)
include_directories(/Volumes/CaseSensitive/cross/x86_64-linux/include/)
include_directories(/Volumes/CaseSensitive/cross/x86_64-linux/include/linux/)
include_directories(/Volumes/CaseSensitive/cross/x86_64-linux/include/c++/10.2.0/)
#include_directories(/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include)
#set(Boost_NO_SYSTEM_PATHS true)
#set(BOOST_INCLUDEDIR /Volumes/CaseSensitive/vcpkgLinux/installed/x64-linux/include/boost/)
#set(BOOST_LIBRARYDIR /Volumes/CaseSensitive/vcpkgLinux/installed/x64-linux/debug/lib/)
#add_link_options(-g -isysroot /Volumes/CaseSensitive/cross/x86_64-linux)
find_package(boost REQUIRED)
find_package(Threads REQUIRED)
endif()
# Install packages
find_package(wt REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(cryptopp CONFIG REQUIRED)
find_package(cpr CONFIG REQUIRED)
add_library(json11 STATIC IMPORTED)
set_target_properties(json11 PROPERTIES IMPORTED_LOCATION ${LIB_DIR}/libjson11.a)
# Include sub-projects.
add_subdirectory ("ImpromptuServer")
But I get a ton of errors like this:
[main] Building folder: ImpromptuServer
[build] Starting build
[proc] Executing command: /usr/local/bin/cmake --build /Users/jackhogan/Desktop/Code/C++/ImpromptuServer/build --config Debug --target all -- -j 22
[build] [22/29 3% :: 0.087] Building CXX object ImpromptuServer/CMakeFiles/libapi.dir/api/internal/ios/AppStore.cpp.o
[build] [23/29 6% :: 0.091] Building CXX object ImpromptuServer/CMakeFiles/ImpromptuServer.dir/api/internal/ios/AppStore.cpp.o
[build] [24/29 10% :: 1.946] Building CXX object ImpromptuServer/CMakeFiles/ImpromptuServer.dir/web/pages/About.cpp.o
[build] FAILED: ImpromptuServer/CMakeFiles/ImpromptuServer.dir/web/pages/About.cpp.o
[build] /Volumes/CaseSensitive/cross/bin/x86_64-linux-g++ --sysroot=/Volumes/CaseSensitive/cross/x86_64-linux/ -DBOOST_ALL_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_THREAD_DYN_LINK -I/Volumes/CaseSensitive/cross/x86_64-linux/lib -I/Volumes/CaseSensitive/cross/x86_64-linux/lib64 -isystem /Volumes/CaseSensitive/vcpkgLinux/installed/x64-linux/include -isystem /usr/local/include -isystem /Volumes/CaseSensitive/vcpkgLinux/installed/x64-linux/include/openssl -isystem /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -g -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -std=gnu++17 -MD -MT ImpromptuServer/CMakeFiles/ImpromptuServer.dir/web/pages/About.cpp.o -MF ImpromptuServer/CMakeFiles/ImpromptuServer.dir/web/pages/About.cpp.o.d -o ImpromptuServer/CMakeFiles/ImpromptuServer.dir/web/pages/About.cpp.o -c ../ImpromptuServer/web/pages/About.cpp
[build] In file included from /Volumes/CaseSensitive/cross/x86_64-linux/include/c++/10.2.0/bits/localefwd.h:40,
[build] from /Volumes/CaseSensitive/cross/x86_64-linux/include/c++/10.2.0/string:43,
[build] from /Volumes/CaseSensitive/cross/x86_64-linux/include/c++/10.2.0/bitset:47,
[build] from /Volumes/CaseSensitive/vcpkgLinux/installed/x64-linux/include/Wt/WWebWidget.h:11,
[build] from /Volumes/CaseSensitive/vcpkgLinux/installed/x64-linux/include/Wt/WInteractWidget.h:10,
[build] from /Volumes/CaseSensitive/vcpkgLinux/installed/x64-linux/include/Wt/WContainerWidget.h:10,
[build] from ../ImpromptuServer/web/pages/About.hpp:3,
[build] from ../ImpromptuServer/web/pages/About.cpp:1:
[build] /Volumes/CaseSensitive/cross/x86_64-linux/include/c++/10.2.0/x86_64-linux/bits/c++locale.h:52:23: error: 'uselocale' was not declared in this scope; did you mean 'setlocale'?
[build] 52 | extern "C" __typeof(uselocale) __uselocale;
[build] | ^~~~~~~~~
[build] | setlocale
[build] /Volumes/CaseSensitive/cross/x86_64-linux/include/c++/10.2.0/x86_64-linux/bits/c++locale.h:62:11: error: '__locale_t' does not name a type
[build] 62 | typedef __locale_t __c_locale;
[build] | ^~~~~~~~~~
[build] /Volumes/CaseSensitive/cross/x86_64-linux/include/c++/10.2.0/x86_64-linux/bits/c++locale.h:69:26: error: '__c_locale' does not name a type
[build] 69 | __convert_from_v(const __c_locale& __cloc __attribute__ ((__unused__)),
[build] | ^~~~~~~~~~
[build] /Volumes/CaseSensitive/cross/x86_64-linux/include/c++/10.2.0/x86_64-linux/bits/c++locale.h: In function 'int std::__convert_from_v(const int&, char*, int, const char*, ...)':
[build] /Volumes/CaseSensitive/cross/x86_64-linux/include/c++/10.2.0/x86_64-linux/bits/c++locale.h:75:5: error: '__c_locale' was not declared in this scope; did you mean '__cloc'?
[build] 75 | __c_locale __old = __gnu_cxx::__uselocale(__cloc);
[build] | ^~~~~~~~~~
[build] | __cloc
[build] /Volumes/CaseSensitive/cross/x86_64-linux/include/c++/10.2.0/x86_64-linux/bits/c++locale.h:100:28: error: '__old' was not declared in this scope
[build] 100 | __gnu_cxx::__uselocale(__old);
[build] | ^~~~~
[build] /Volumes/CaseSensitive/cross/x86_64-linux/include/c++/10.2.0/x86_64-linux/bits/c++locale.h:100:33: error: '__gnu_cxx::__uselocale' cannot be used as a function
[build] 100 | __gnu_cxx::__uselocale(__old);
[build] | ^
Edit 3
Here is my CMake output:
[main] Configuring folder: ImpromptuServer
[driver] Removing /Users/jackhogan/Desktop/Code/C++/ImpromptuServer/build/CMakeCache.txt
[driver] Removing /Users/jackhogan/Desktop/Code/C++/ImpromptuServer/build/CMakeFiles
[proc] Executing command: /usr/local/bin/cmake --no-warn-unused-cli -DCMAKE_TOOLCHAIN_FILE=/Volumes/CaseSensitive/vcpkgLinux/scripts/buildsystems/vcpkg.cmake -DCMAKE_CROSSCOMPILING=True -Wno-dev -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:FILEPATH=/Volumes/CaseSensitive/cross/bin/x86_64-linux-gcc -DCMAKE_CXX_COMPILER:FILEPATH=/Volumes/CaseSensitive/cross/bin/x86_64-linux-g++ -H/Users/jackhogan/Desktop/Code/C++/ImpromptuServer -B/Users/jackhogan/Desktop/Code/C++/ImpromptuServer/build -G Ninja
[cmake] Not searching for unused variables given on the command line.
[cmake] -- The C compiler identification is GNU 10.2.0
[cmake] -- The CXX compiler identification is GNU 10.2.0
[cmake] -- Checking whether C compiler has -isysroot
[cmake] -- Checking whether C compiler has -isysroot - yes
[cmake] -- Checking whether C compiler supports OSX deployment target flag
[cmake] -- Checking whether C compiler supports OSX deployment target flag - no
[cmake] -- Detecting C compiler ABI info
[cmake] -- Detecting C compiler ABI info - done
[cmake] -- Check for working C compiler: /Volumes/CaseSensitive/cross/bin/x86_64-linux-gcc - skipped
[cmake] -- Detecting C compile features
[cmake] -- Detecting C compile features - done
[cmake] -- Checking whether CXX compiler has -isysroot
[cmake] -- Checking whether CXX compiler has -isysroot - yes
[cmake] -- Checking whether CXX compiler supports OSX deployment target flag
[cmake] -- Checking whether CXX compiler supports OSX deployment target flag - no
[cmake] -- Detecting CXX compiler ABI info
[cmake] -- Detecting CXX compiler ABI info - done
[cmake] -- Check for working CXX compiler: /Volumes/CaseSensitive/cross/bin/x86_64-linux-g++ - skipped
[cmake] -- Detecting CXX compile features
[cmake] -- Detecting CXX compile features - done
[cmake] INFO Using Linux protocols
[cmake] -- Found Boost: /usr/local/lib/cmake/Boost-1.72.0/BoostConfig.cmake (found version "1.72.0")
[cmake] -- Looking for pthread.h
[cmake] -- Looking for pthread.h - not found
[cmake] -- Found Threads: TRUE
[cmake] -- Found OpenSSL: /usr/lib/libcrypto.dylib
[cmake] -- Found ZLIB: /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/lib/libz.tbd (found version "1.2.11")
[cmake] -- Found CURL: /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/lib/libcurl.tbd (found version "7.64.1")
[cmake] -- Configuring done
[cmake] -- Generating done
[cmake] -- Build files have been written to: /Users/jackhogan/Desktop/Code/C++/ImpromptuServer/build
[cmakefileapi-parser] Code model version (2.1) of cmake-file-api is unexpected. Expecting (2.0). IntelliSense configuration may be incorrect.
[cmakefileapi-parser] Code model version (2.1) of cmake-file-api is unexpected. Expecting (2.0). IntelliSense configuration may be incorrect.
After a week of trying to get this to work, I finally have a solution. The solution came from this answer. Here is my final working CMake file that can compile for both MacOS and Linux:
# CMakeList.txt : Top-level CMake project file, do global configuration
# and include sub-projects here.
#
cmake_minimum_required(VERSION 3.8)
# Target-specific stuff to be done before creating the project
if(${USE_LINUX})
# Prevents linker from not finding program entry point
set(HAVE_FLAG_SEARCH_PATHS_FIRST 0)
endif()
project (ImpromptuServer CXX)
if(NOT ${USE_LINUX})
message(INFO " Using MacOS protocols")
if(NOT ${CMAKE_TOOLCHAIN_FILE} STREQUAL /Users/jackhogan/Desktop/Code/Utilities/vcpkg/scripts/buildsystems/vcpkg.cmake)
message(FATAL_ERROR " Incorrect toolchain file")
endif()
set(LIB_DIR /Users/jackhogan/Desktop/Code/Utilities/vcpkg/installed/x64-osx/debug/lib)
add_compile_options(-std=c++17)
find_package(Threads REQUIRED)
else()
message(INFO " Using Linux protocols")
if(NOT ${CMAKE_TOOLCHAIN_FILE} STREQUAL /Volumes/CaseSensitive/vcpkgLinux/scripts/buildsystems/vcpkg.cmake)
message(FATAL_ERROR " Incorrect toolchain file")
endif()
set(CMAKE_C_LINK_FLAGS "")
set(CMAKE_CXX_LINK_FLAGS "")
add_compile_options(-std=gnu++17)
add_link_options(-Wl,--copy-dt-needed-entries)
set(CMAKE_CROSSCOMPILING true)
# Get rid of OSX SDK to prevent incorrect linking
set(CMAKE_OSX_SYSROOT "/Volumes/CaseSensitive/cross/x86_64-linux/include/")
set(LIB_DIR /Volumes/CaseSensitive/vcpkgLinux/installed/x64-linux/debug/lib)
set(CMAKE_FIND_ROOT_PATH /Volumes/CaseSensitive/vcpkgLinux/installed/x64-linux/debug/lib)
set(CMAKE_SYSROOT /)
# Find libraries, may be changed later
set(wt_DIR /Volumes/CaseSensitive/vcpkgLinux/installed/x64-linux/share/wt/)
set(cryptopp_DIR /Volumes/CaseSensitive/vcpkgLinux/installed/x64-linux/share/cryptopp/)
set(cpr_DIR /Volumes/CaseSensitive/vcpkgLinux/installed/x64-linux/share/cpr/)
set(OPENSSL_INCLUDE_DIR /Volumes/CaseSensitive/vcpkgLinux/installed/x64-linux/include/openssl)
set(OPENSSL_ROOT_DIR /Volumes/CaseSensitive/cross/x86_64-linux/lib/)
# Cheat a little bit by linking a dynamic library
set(OPENSSL_CRYPTO_LIBRARY /Volumes/CaseSensitive/cross/x86_64-linux/lib/libcrypto.a)
set(OPENSSL_USE_STATIC_LIBS true)
# Special system library include directories
set(ZLIB_INCLUDE_DIR /Volumes/CaseSensitive/vcpkgLinux/installed/x64-linux/include/)
set(ZLIB_ROOT /Volumes/CaseSensitive/vcpkgLinux/installed/x64-linux/lib/)
set(CURL_INCLUDE_DIR /Volumes/CaseSensitive/vcpkgLinux/installed/x64-linux/include/curl/)
# Find pthread and link to non-apple
set(CMAKE_THREAD_LIBS_INIT /Volumes/CaseSensitive/cross/x86_64-linux/lib/libpthread.a)
# GCC includes
include_directories(SYSTEM /Volumes/CaseSensitive/cross/lib/gcc/x86_64-linux/10.2.0/include/)
# System includes
include_directories(SYSTEM /Volumes/CaseSensitive/cross/x86_64-linux/include/c++/10.2.0/)
#set(BOOST_INCLUDE_DIR /Volumes/CaseSensitive/vcpkgLinux/installed/x64-linux/include/boost/)
set(Boost_NO_BOOST_CMAKE on)
set(Boost_USE_STATIC_LIBS true)
set(Boost_LIBRARY_DIR /Volumes/CaseSensitive/vcpkgLinux/installed/x64-linux/lib/)
find_package(Boost COMPONENTS program_options filesystem thread chrono date_time REQUIRED)
find_package(Threads REQUIRED)
endif()
# Install packages
find_package(wt REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(cryptopp CONFIG REQUIRED)
find_package(cpr CONFIG REQUIRED)
add_library(json11 STATIC IMPORTED)
set_target_properties(json11 PROPERTIES IMPORTED_LOCATION ${LIB_DIR}/libjson11.a)
# Include sub-projects.
add_subdirectory ("ImpromptuServer")
While all of the paths are system-specific, this could be improved later with some more advanced scripting. Here are the arguments I pass in on MacOS and Linux respectively:
-DCMAKE_TOOLCHAIN_FILE=/Users/jackhogan/Desktop/Code/Utilities/vcpkg/scripts/buildsystems/vcpkg.cmake -DUSE_LINUX=false
-DCMAKE_TOOLCHAIN_FILE=/Volumes/CaseSensitive/vcpkgLinux/scripts/buildsystems/vcpkg.cmake -DUSE_LINUX=true

CMake Errors -Using Conan in the yuzu generator

I am using vs code and CMake to generator the yuzu project, but the CMakeList.txt always report error on the conan code since line 127 ,and I have already install the conan in the CMD with pip command.
Yuzu project and the CMakeList.txt
CMake output
[proc] run command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli "-Dcmake.cmakePath:STRING=C:/Program Files/CMake/bin/cmake" -Dcmake.configureOnOpen:BOOL=TRUE "-Dcmake.generator:STRING=MinGW Makefiles" -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -He:/Visual_Studio_Code/yuzu_emulator/yuzu -Be:/Visual_Studio_Code/yuzu_emulator/yuzu/build -G "Visual Studio 16 2019" -T host=x86 -A win32
[cmake] Not searching for unused variables given on the command line.
[cmake] -- Target architecture: x86
[cmake] -- Could NOT find Boost (missing: Boost_INCLUDE_DIR) (Required is at least version "1.71")
[cmake] -- Could NOT find Catch2 (missing: Catch2_INCLUDE_DIR Catch2_VERSION) (Required is at least version "2.11")
[cmake] -- Could NOT find fmt (missing: fmt_LIBRARY fmt_INCLUDE_DIR fmt_VERSION) (Required is at least version "6.2")
[cmake] -- Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY OPENSSL_INCLUDE_DIR) (Required is at least version "1.1")
[cmake] -- Could NOT find lz4 (missing: lz4_LIBRARY lz4_INCLUDE_DIR) (Required is at least version "1.8")
[cmake] -- Could NOT find nlohmann_json (missing: nlohmann_json_INCLUDE_DIR nlohmann_json_VERSION) (Required is at least version "3.7")
[cmake] -- Could NOT find opus (missing: opus_LIBRARY opus_INCLUDE_DIR) (Required is at least version "1.3")
[cmake] -- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR) (Required is at least version "1.2")
[cmake] -- Could NOT find zstd (missing: zstd_LIBRARY zstd_INCLUDE_DIR zstd_VERSION) (Required is at least version "1.4")
[cmake] CMake Warning at CMakeLists.txt:217 (find_package):
[cmake] By not providing "FindQt5.cmake" in CMAKE_MODULE_PATH this project has
[cmake] asked CMake to find a package configuration file provided by "Qt5", but
[cmake] CMake did not find one.
[cmake]
[cmake] Could not find a package configuration file provided by "Qt5" (requested
[cmake] version 5.9) with any of the following names:
[cmake]
[cmake] Qt5Config.cmake
[cmake] qt5-config.cmake
[cmake]
[cmake] Add the installation prefix of "Qt5" to CMAKE_PREFIX_PATH or set "Qt5_DIR"
[cmake] to a directory containing one of the above files. If "Qt5" provides a
[cmake] separate development package or SDK, be sure it has been installed.
[cmake]
[cmake]
[cmake] CMake Warning at CMakeLists.txt:229 (find_package):
[cmake] By not providing "FindSDL2.cmake" in CMAKE_MODULE_PATH this project has
[cmake] asked CMake to find a package configuration file provided by "SDL2", but
[cmake] CMake did not find one.
[cmake]
[cmake] Could not find a package configuration file provided by "SDL2" with any of
[cmake] the following names:
[cmake]
[cmake] SDL2Config.cmake
[cmake] sdl2-config.cmake
[cmake]
[cmake] Add the installation prefix of "SDL2" to CMAKE_PREFIX_PATH or set
[cmake] "SDL2_DIR" to a directory containing one of the above files. If "SDL2"
[cmake] provides a separate development package or SDK, be sure it has been
[cmake] installed.
[cmake]
[cmake]
[cmake] -- Packages boost/1.72.0;catch2/2.11.0;fmt/6.2.0;openssl/1.1.1f;lz4/1.9.2;nlohmann_json/3.7.3;opus/1.3.1;zlib/1.2.11;zstd/1.4.4;qt/5.14.1#bincrafters/stable;sdl2/2.0.12#bincrafters/stable not found!
[cmake] -- Configuring incomplete, errors occurred!
[cmake] See also "E:/Visual_Studio_Code/yuzu_emulator/yuzu/build/CMakeFiles/CMakeOutput.log".
[cmake] See also "E:/Visual_Studio_Code/yuzu_emulator/yuzu/build/CMakeFiles/CMakeError.log".
[cmake] CMake Error at CMakeLists.txt:252 (conan_check):
[cmake] Unknown CMake command "conan_check".
generally its a problem that the CMakeList.txt file can't run the code about the conan and the lib can't be auto download, but how can i sovle the porblem, bro??????The project do not offer the conan.cmake. im a web developer,not familiar with the c++ proj construct.
The CMakeLists.txt of the yuzu repository (found at the parent directory) requires version 1.24.0 of conan, while the latest is 1.25.2. I assume you have installed the latest version.
Change line 252 from:
conan_check(VERSION 1.24.0 REQUIRED)
to:
conan_check(VERSION 1.25.2 REQUIRED)
and it should work.
Do not forget to delete the cmake cache in your build folder.