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

What if multiple libraries within one project? #4

Open
WilliamCodeBox opened this issue Aug 19, 2020 · 1 comment
Open

What if multiple libraries within one project? #4

WilliamCodeBox opened this issue Aug 19, 2020 · 1 comment

Comments

@WilliamCodeBox
Copy link

Good job on this CMake based c++ template project.
I have been developing a C++ project which contains multiple libraries, and I intend to use this template repo.

My project layout now looks like following:

|── include
│   ├── lib1_headers
│   ├── lib2_headers
│   ├── lib3_headers
└── source
    ├── lib1_srcs
    ├── lib2_srcs
    ├── lib3_srcs

What is the proper way to use this repo and set up my project?
Hope your help...

@pablospe
Copy link
Owner

Yes, this example is one library per one project at the moment. I was thinking to extend it to multiple libraries.

The code that configure the library is here:
https://github.com/pablospe/cmake-example-library/blob/master/cmake/LibraryConfig.cmake

Basically this code should be a function, and be called per library. Not sure about the alias part. Also I believe the FOO_DEBUG should be move SetEnv.cmake perhaps. Perhaps you could give a try to generate this code as function in PR.

Could you comment more about your project structure? How do you want to use it externally? Something like "Foo::lib1"? I am trying to understand why you need multiple libraries. You could also check in the object libraries and expose one to the external. More about object libraries: https://gitlab.kitware.com/cmake/community/-/wikis/doc/tutorials/Object-Library

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

No branches or pull requests

2 participants