Coder Social home page Coder Social logo

cmake_utilities's People

Contributors

cpp-entwickler-de avatar daixtrose avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

sickeroni

cmake_utilities's Issues

Pure CMake approach

This is a demo that handles dependencies purely in CMake by reading dependencies.txt files from the root directory of a project (and recursively for all listed dependencies). It only requires git and a non-ancient CMake version (> 3.19) to be installed.

The dependencies.txt format is repo-uri revision [subdirectory] with one dependency per line. revision can be anything that can be checked out by git. subdirectory is optional in case the dependencies.txt or CMakeLists.txt file are not in the git root.

The RepoMan module can be either included in CMake projects or be called by its name on the command line inside a non-CMake project. The demo projects already include it, but it can also be called via command line while within any project directory. The only difference is that the latter will not configure/generate a project.

repoman.zip

Dependency resolver ignores user-defined name of library

Summary

Not sure if this is a bug. FetchContent allows one to declare private names for dependencies (please note the lowercase catch2):

FetchContent(catch2 GIT_REPOSITORY https://github.com/catchorg/Catch2 GIT_TAG v2.x)

But it seems that the directory population uses the original uppercase name. To my surprise the reference to the _SOURCE_DIR must use the original upper case name, i.e.

list(APPEND CMAKE_MODULE_PATH ${Catch2_SOURCE_DIR}/contrib)

How to reproduce

Use the testsuite in https://github.com/dep-heaven/tool_1:

git clone https://github.com/dep-heaven/tool_1
cd tool_1/
mkdir build
cd build/
cmake ..

Output

...
WARNING! Something is still wrong here!
   RepoMan should populate selected name, not original name
==> Toplevel: catch2_SOURCE_DIR = ''
==> Toplevel: Catch2_SOURCE_DIR = '/home/markus/PROJECT/GARBAGE/tool_1/ws/catch2'
==> Toplevel: lib_A_SOURCE_DIR = '/home/markus/PROJECT/GARBAGE/tool_1/ws/lib_A'
...

Dependency target not found

How to reproduce

Use the testsuite in https://github.com/dep-heaven/tool_1:

git clone https://github.com/dep-heaven/tool_1
cd tool_1/
mkdir build
cd build/
cmake ..

Output

Cloning into 'tool_1'...
remote: Enumerating objects: 33, done.
remote: Counting objects: 100% (33/33), done.
remote: Compressing objects: 100% (25/25), done.
remote: Total 33 (delta 9), reused 25 (delta 5), pack-reused 0
Receiving objects: 100% (33/33), 8.45 KiB | 577.00 KiB/s, done.
Resolving deltas: 100% (9/9), done.
-- The CXX compiler identification is GNU 11.4.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Resolving dependencies of project /home/markus/PROJECT/GARBAGE/tool_1
-- Checking dependency 'lib_A': https://github.com/dep-heaven/lib_A @ master-yoda
-- Initializing in '/home/markus/PROJECT/GARBAGE/tool_1/ws/lib_A'
-- Checking dependency 'lib_B': https://github.com/dep-heaven/lib_B @ master-yoda
-- Initializing in '/home/markus/PROJECT/GARBAGE/tool_1/ws/lib_B'
-- Checking dependency 'libFreeAssange': https://github.com/dep-heaven/libFreeAssange @ belmarsh
-- Initializing in '/home/markus/PROJECT/GARBAGE/tool_1/ws/libFreeAssange'
-- Checking dependency 'catch2': https://github.com/catchorg/Catch2 @ v2.x
-- Initializing in '/home/markus/PROJECT/GARBAGE/tool_1/ws/catch2'
-- Checking dependency 'fmt': https://github.com/fmtlib/fmt @ master
-- Initializing in '/home/markus/PROJECT/GARBAGE/tool_1/ws/fmt'
-- The C compiler identification is GNU 12.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Version: 10.1.1
-- Build type: 
WARNING! Something is still wrong here!
   RepoMan should populate selected name, not original name
==> Toplevel: catch2_SOURCE_DIR = ''
==> Toplevel: Catch2_SOURCE_DIR = '/home/markus/PROJECT/GARBAGE/tool_1/ws/catch2'
==> Toplevel: lib_A_SOURCE_DIR = '/home/markus/PROJECT/GARBAGE/tool_1/ws/lib_A'
Catch path is '/home/markus/PROJECT/GARBAGE/tool_1/ws/catch2/extras'
-- DEFINE_UNIT_TEST_NAME = test_tool_1
-- DEFINE_UNIT_TEST_FILES = ../src/fn.cpp;test_main.cpp;test_tool_1.cpp
-- Dependencies:
--     lib_A @ master-yoda, chosen from [master-yoda]
--     lib_B @ master-yoda, chosen from [master-yoda]
--     libFreeAssange @ belmarsh, chosen from [belmarsh]
--     catch2 @ v2.x, chosen from [v2.x]
--     fmt @ master, chosen from [master]
-- Configuring done
CMake Error at test-catch/CMakeLists.txt:24 (add_executable):
  Target "test_tool_1" links to target "Daixtrose::lib_A" but the target was
  not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?
Call Stack (most recent call first):
  test-catch/CMakeLists.txt:43 (define_unit_test)


CMake Error at CMakeLists.txt:47 (add_executable):
  Target "tool_1" links to target "Daixtrose::lib_A" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.