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

CMake: Optional Install if Embedded #1330

Merged
merged 1 commit into from Mar 13, 2019

Conversation

ax3l
Copy link
Contributor

@ax3l ax3l commented Nov 2, 2018

When adding this library as embedded library with private "target link", e.g. only used inside private source files, the library does not need to be installed when the main project gets installed.

This adds an additional option JSON_Install similar to the test-build control switch in order to skip installing headers and CMake config files if requested.

Avoids using

add_subdirectory(path/to/nlohmann_json EXCLUDE_FROM_ALL)

which has further side-effects:
https://cmake.org/cmake/help/v3.0/command/add_subdirectory.html

cc @chuckatkins do you have an opinion on this?

When adding this library as embedded library with private
"target link", e.g. only used inside private source files, the
library does not need to be installed when the main project gets
installed.

This adds an additional option `JSON_Install` similar to the
test-build control switch in order to skip installing headers and
CMake config files if requested.

Avoids using
```cmake
add_subdirectory(path/to/nlohmann_json EXCLUDE_FROM_ALL)
```

which has further side-effects:
https://cmake.org/cmake/help/v3.0/command/add_subdirectory.html
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling f049836 on ax3l:topic-installEmbed into 2f73a4d on nlohmann:develop.

@nlohmann
Copy link
Owner

Yes, I would also know what @chuckatkins thinks about this.

@stale
Copy link

stale bot commented Dec 11, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated label Dec 11, 2018
@ax3l
Copy link
Contributor Author

ax3l commented Dec 11, 2018

Any thoughts, @chuckatkins ?

@stale stale bot removed the state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated label Dec 11, 2018
@stale
Copy link

stale bot commented Jan 15, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated label Jan 15, 2019
@ax3l
Copy link
Contributor Author

ax3l commented Jan 15, 2019

Hi @chuckatkins, sorry to bother you about this but I wonder if this is good practice or if you also just go with add_subdirectory(path/to/nlohmann_json EXCLUDE_FROM_ALL). The latter has more side-effects besides install-skipping.

@stale stale bot removed the state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated label Jan 15, 2019
@stale
Copy link

stale bot commented Feb 14, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated label Feb 14, 2019
@ax3l
Copy link
Contributor Author

ax3l commented Feb 14, 2019

ping @chuckatkins any idea?

@stale stale bot removed the state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated label Feb 14, 2019
@t-b
Copy link
Contributor

t-b commented Mar 12, 2019

@ax3l @nlohmann I just came up with the exact same patches. Should have checked the PRs first ;)

Can I help with something to get this merged?

@ax3l
Copy link
Contributor Author

ax3l commented Mar 13, 2019

@t-b I am still wondering what other projects do, since this seems to be a common workflow that a simple EXCLUDE_FROM_ALL doesn't cut.
Besides that, we could merge it. It's in the worst-case just a project specific option we can control.

Copy link
Owner

@nlohmann nlohmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@nlohmann nlohmann self-assigned this Mar 13, 2019
@nlohmann nlohmann added this to the Release 3.6.0 milestone Mar 13, 2019
@nlohmann nlohmann merged commit d39842e into nlohmann:develop Mar 13, 2019
@nlohmann
Copy link
Owner

Thanks a lot!

@t-b
Copy link
Contributor

t-b commented Mar 13, 2019

@nlohmann Thanks for merging.

@ax3l According to https://stackoverflow.com/a/51746390 most projects add an option to skip the installation.

@ax3l ax3l deleted the topic-installEmbed branch March 14, 2019 10:58
@ax3l
Copy link
Contributor Author

ax3l commented Mar 14, 2019

Good to know, so my intuition wasn't all off.

Thanks for merging!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants