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

Respect Parent Project's use of CMAKE_RUNTIME_OUTPUT_DIRECTORY #1545

Closed
jwillikers opened this issue Feb 6, 2020 · 3 comments
Closed

Respect Parent Project's use of CMAKE_RUNTIME_OUTPUT_DIRECTORY #1545

jwillikers opened this issue Feb 6, 2020 · 3 comments

Comments

@jwillikers
Copy link
Contributor

The use of CMAKE_RUNTIME_OUTPUT_DIRECTORY in the CMakeLists.txt file does not allow parent projects to override it.
Would it be possible to only set that variable if it is not already set?
The CMake code to accomplish follows below.

if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
endif()
@jwillikers
Copy link
Contributor Author

You might also want to use GNUInstallDirs.

if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
  include(GNUInstallDirs)
  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR})
endif()

@vitaut
Copy link
Contributor

vitaut commented Feb 6, 2020

Would it be possible to only set that variable if it is not already set?

Sure, a PR is welcome.

You might also want to use GNUInstallDirs.

I suggest keeping bin for simplicity.

@jwillikers
Copy link
Contributor Author

I'll get a PR ready.

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