Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot build the project with cmake fetchContent #874

Open
billcxx opened this issue Oct 3, 2022 · 1 comment · May be fixed by #875
Open

Cannot build the project with cmake fetchContent #874

billcxx opened this issue Oct 3, 2022 · 1 comment · May be fixed by #875

Comments

@billcxx
Copy link

billcxx commented Oct 3, 2022

I can compile Ecl on the same machine with the normal git clone and cmake process, but I cannot compile Ecl if it is included by fetchContent as follows

FetchContent_Declare(
  ecl
  GIT_REPOSITORY https://github.com/equinor/ecl.git
  GIT_SUBMODULES ""
  GIT_TAG 2.14.0)
FetchContent_MakeAvailable(ecl)

When I try to configure my project, I met an error during

CMake Error at build/x64-gnu-Debug/_deps/ecl-src/lib/CMakeLists.txt:182 (set_target_properties):
  set_target_properties called with incorrect number of arguments.

Here is full output to the console

cmake: /usr/local/lib/libcurl.so.4: no version information available (required by cmake)
-- Set build type to Debug configuration
-- --fasp/opt/faspsolver/include/opt/faspsolver/lib/libfasp.a
-- Conan: Automatic detection of conan settings from cmake
/usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake)
-- Conan: compiler.cppstd was added as an argument. Not using the autodetected one.
-- Conan: Settings= -s;build_type=Debug;-s;compiler=gcc;-s;compiler.version=11;-s;compiler.libcxx=libstdc++11;-s;compiler.cppstd=17
-- Conan: checking conan executable
-- Conan: Found program /home/xcheng/.local/bin/conan
-- Conan: Version found Conan version 1.52.0
-- Conan executing: /home/xcheng/.local/bin/conan install . -s build_type=Debug -s compiler=gcc -s compiler.version=11 -s compiler.libcxx=libstdc++11 -s compiler.cppstd=17 -g=cmake --build=missing
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Debug
compiler=gcc
compiler.cppstd=17
compiler.libcxx=libstdc++11
compiler.version=11
os=Linux
os_build=Linux
[options]
[build_requires]
[env]

conanfile.txt: Installing package
Requirements
    backward-cpp/1.6 from 'cci' - Cache
    fmt/8.0.1 from 'cci' - Cache
    libdwarf/20191104 from 'cci' - Cache
    libelf/0.8.13 from 'cci' - Cache
    zlib/1.2.12 from 'cci' - Cache
Packages
    backward-cpp/1.6:61fa5696262c64338f31bb777c3e335f70957491 - Cache
    fmt/8.0.1:5583290743b011a202b71a31a607075136bc28bb - Cache
    libdwarf/20191104:29a01e41514e57b26ac6cb3d59a534cdaa425a4d - Cache
    libelf/0.8.13:be27726f9885116da1158027505be62e913cd585 - Cache
    zlib/1.2.12:be27726f9885116da1158027505be62e913cd585 - Cache

Installing (downloading, building) binaries...
fmt/8.0.1: Already installed!
libelf/0.8.13: Already installed!
zlib/1.2.12: Already installed!
libdwarf/20191104: Already installed!
backward-cpp/1.6: Already installed!
conanfile.txt: Generator cmake created conanbuildinfo.cmake
conanfile.txt: Generator txt created conanbuildinfo.txt
conanfile.txt: Aggregating env generators
conanfile.txt: Generated conaninfo.txt
conanfile.txt: Generated graphinfo
-- Conan: Loading conanbuildinfo.cmake
-- Conan: Adjusting output directories
-- Conan: Using cmake targets configuration
-- Library backward found /home/xcheng/.conan/data/backward-cpp/1.6/_/_/package/61fa5696262c64338f31bb777c3e335f70957491/lib/libbackward.a
-- Library fmtd found /home/xcheng/.conan/data/fmt/8.0.1/_/_/package/5583290743b011a202b71a31a607075136bc28bb/lib/libfmtd.a
-- Library dwarf found /home/xcheng/.conan/data/libdwarf/20191104/_/_/package/29a01e41514e57b26ac6cb3d59a534cdaa425a4d/lib/libdwarf.a
-- Library elf found /home/xcheng/.conan/data/libelf/0.8.13/_/_/package/be27726f9885116da1158027505be62e913cd585/lib/libelf.a
-- Library z found /home/xcheng/.conan/data/zlib/1.2.12/_/_/package/be27726f9885116da1158027505be62e913cd585/lib/libz.a
-- Conan: Adjusting default RPATHs Conan policies
-- Conan: Adjusting language standard
-- Current conanbuildinfo.cmake directory: /home/xcheng/codes/OpenCAEPoro/build/x64-gnu-Debug/_deps/ecl-build
-- Conan: Compiler GCC>=5, checking major version 11
-- Conan: Checking correct version: 11
fatal: No names found, cannot describe anything.
-- libecl version: ..
-- Found Linux
-- OpenMP disabled
CMake Error at build/x64-gnu-Debug/_deps/ecl-src/lib/CMakeLists.txt:182 (set_target_properties):
  set_target_properties called with incorrect number of arguments.


-- Configuring incomplete, errors occurred!
See also "/home/xcheng/codes/OpenCAEPoro/build/x64-gnu-Debug/CMakeFiles/CMakeOutput.log".
See also "/home/xcheng/codes/OpenCAEPoro/build/x64-gnu-Debug/CMakeFiles/CMakeError.log".

I notice the difference between the normal build process and the fetchContent process is these two lines

fatal: No names found, cannot describe anything.
-- libecl version: ..
@billcxx
Copy link
Author

billcxx commented Oct 3, 2022

The problem is in the root CMakeLists.txt file, line 128 to line 132.
The ${CMAKE_SOURCE_DIR} is my own projects directory rather than the populated Ecl directory.

128     execute_process(
129       COMMAND ${GIT_EXECUTABLE} "--git-dir=${CMAKE_SOURCE_DIR}/.git" describe
130               --tags
131       OUTPUT_VARIABLE GIT_TAG
132       OUTPUT_STRIP_TRAILING_WHITESPACE)

@billcxx billcxx linked a pull request Oct 3, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant