Comments (7)
OK, but do not forget the spaces!
from moderncppstarter.
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 don
t 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.
Should I maybe create a pull request?
I actually think this is a big oversight for a starter template.
from moderncppstarter.
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.
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.
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.
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)
- permissive -> permissive- HOT 1
- Use `code-coverage.cmake` from `cmake-scripts` HOT 7
- `cmake --build build/docs --target GenerateDocs` not working HOT 16
- Update `PackageProject.cmake` to 1.8.0
- CMake Error at ../CMakeLists.txt:47 (add_library): HOT 1
- version.h is missing in include/greeter HOT 1
- Support sonarcloud.io HOT 1
- Include errors HOT 13
- how to generate build file of bazel in cmake? HOT 2
- `cmake --build build/test` fails HOT 1
- GUI design HOT 1
- The GitHub workflow actions needs an update HOT 1
- configure test only does not work if CPM_USE_LOCAL_PACKAGES is TRUE
- Use of deprecated ConstructorInitializerAllOnOneLineOrOnePerLine .clang-format option HOT 3
- update get_cpm.cmake within the GitHub workflow HOT 1
- Having a issue when adding asio to my project using this template HOT 10
- Unable to open source file "doctest/doctest.h" and "cxxopts.hpp" HOT 21
- Suggestion to define main project name in a separate file HOT 1
- Misspelled "ModernCppStater" in documentation/pages/about.dox HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from moderncppstarter.