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

fix: Only add build type to CMAKE_LIBRARY_OUTPUT_DIRECTORY if needed #299

Merged
merged 2 commits into from
Feb 12, 2023

Conversation

trxcllnt
Copy link
Contributor

@trxcllnt trxcllnt commented Feb 4, 2023

This PR only appends CMAKE_BUILD_TYPE to CMAKE_LIBRARY_OUTPUT_DIRECTORY if the build dir path doesn't already end with the build type.

Maintaining parallel build trees for release/debug can reduce rebuild times when switching between configs*.

If a user wishes to configure this way today, cmake-js defines a nonsense path for LIBRARY_OUTPUT_DIRECTORY:

npx cmake-js -D -O build/Debug
# -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=build/Debug/Debug

npx cmake-js -O build/Release
# -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=build/Release/Release

I assume this is to align with node-gyp and require('bindings')('foo.node'), which this PR would still support.

If the user configured into build/${cmake_build_type}, the LIBRARY_OUTPUT_DIRECTORY should be ${cmake_binary_dir}, not ${cmake_binary_dir}/{cmake_build_type}.

* An alternative could be to customize the location of the object files based on build type... but this isn't supported by CMake 🙁.

@Julusian Julusian changed the title Only add build type to CMAKE_LIBRARY_OUTPUT_DIRECTORY if needed fix: Only add build type to CMAKE_LIBRARY_OUTPUT_DIRECTORY if needed Feb 12, 2023
@Julusian Julusian merged commit e2452ee into cmake-js:master Feb 12, 2023
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

Successfully merging this pull request may close these issues.

None yet

2 participants