Git Product home page Git Product logo

Comments (7)

ClausKlein avatar ClausKlein commented on May 13, 2024 1

OK, but do not forget the spaces!

from moderncppstarter.

DominicD avatar DominicD commented on May 13, 2024 1

Some examples I found:

https://github.com/nlohmann/json/blob/develop/CMakeLists.txt
https://github.com/gabime/spdlog/blob/v1.x/CMakeLists.txt
https://github.com/CoatiSoftware/Sourcetrail/blob/master/CMakeLists.txt
https://github.com/amrayn/easyloggingpp/blob/master/CMakeLists.txt
https://github.com/aws/aws-sdk-cpp/blob/main/aws-cpp-sdk-wellarchitected/CMakeLists.txt

However I cant really say how popular they are. Lot of the really famous c and c++ projects dont use cmake e.g. OpenSSL, Boost, QT.

Still for me redundancy is always bad. So im curious when do you think it makes sense to not use the ${PROJECT_NAME}?

from moderncppstarter.

DominicD avatar DominicD commented on May 13, 2024

Should I maybe create a pull request?
I actually think this is a big oversight for a starter template.

from moderncppstarter.

TheLartians avatar TheLartians commented on May 13, 2024

I think the main reason I didn't use it was for consistency with the derived targets (tests, standalone, etc), that create their own projects and therefore aren't aware of the main project's name. One way to circumvent this could be to create a config.cmake file that can be included to declare the project name and version, however imo it would remove some of the simplicity of the template. Anyways, you should usually run a simple search-and-replace when customising the starter, so that all include paths etc reference the new name.

from moderncppstarter.

DominicD avatar DominicD commented on May 13, 2024

Fair point.
However I still think for a template that shall serve as a reference to modern CMake and good practices it should use it.
I don´t know how handle it for the derived targets but still I think it is an improvement.
I prepared it already: https://github.com/DominicD/ModernCppStarter/commit/2528b

If you want I will create a pull request if not its also fine

from moderncppstarter.

TheLartians avatar TheLartians commented on May 13, 2024

Hm I do see the advantages of avoiding redundancy. On the other hand, sometime it may be better to be explicit and see directly what the target in question is. Any idea how other popular C++ projects handle this?

from moderncppstarter.

TheLartians avatar TheLartians commented on May 13, 2024

Cool thanks for the list! So it seems that quite a few libraries do use the project name or other variables to define the library name.

Still for me redundancy is always bad. So im curious when do you think it makes sense to not use the ${PROJECT_NAME}?

TBH not much, just that at the time I didn't have strong flinging and I felt that many projects were explicit in their target naming. Imo it may actually be good idea to use it, especially as we are already using ${PROJECT_NAME} in the PackageProject command.

Would be happy to review a PR for your branch!

from moderncppstarter.

Related Issues (20)

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.