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

List header files as target dependencies #13

Open
schuhschuh opened this issue Dec 13, 2015 · 4 comments
Open

List header files as target dependencies #13

schuhschuh opened this issue Dec 13, 2015 · 4 comments

Comments

@schuhschuh
Copy link
Member

While header files are not required to be in the list of source files of a library or executable target because these are no actual compilation units, CMake IDE generators will not link them in the project files such as Xcode or Visual Studio. Weakly related issue: #4.

@ghisvail
Copy link
Member

Should be solved with appropriate usage of source_group.

@ghisvail
Copy link
Member

@schuhschuh
Copy link
Member Author

That's another thing. Yes, it's nice to define source groups, but adding a file to a source group does not add it automatically also to the list of files of a build target. You still have to add the header files to the list of source files that a target depends on. Another reason for doing this is that the target otherwise will not be rebuild when the header file is modified.

When you look at the example you posted, you will see that they pass both lists of header files and source files to the add_library command.

@schuhschuh schuhschuh changed the title List header files as target source files List header files as target dependencies Dec 13, 2015
@schuhschuh
Copy link
Member Author

BTW I am not sure how valuable source groups are actually in this scenario because source files are already grouped by modules (i.e., separate libraries). Visual Studio, for example, will then have a list of Common module source files in "includes" and "sources" (or so) folders of the Common library target. The same for other modules. Not sure how it is for Xcode or whether source_groups are even used by the respective generator. The command was mainly introduced for Visual Studio as the documentation also states. Source groups would make a lot more sense when source files of all modules would be linked into a single library target.

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