-
Notifications
You must be signed in to change notification settings - Fork 126
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
Need to add /build/Release with visual studio 2015 update 3 #18
Comments
I will say I've been baffled by this in the past as well. Unfortunately I actually know very little about cmake itself, but it seems like this is expected behavior from the various generators? |
It seems that multi-configuration generators like MSVC always create a sub-folder like Debug or Release. I didn't find any way to change that or get the path to the target in CMakeList.txt https://cmake.org/cmake/help/latest/policy/CMP0026.html. by the way you do |
Running into this as well; given that this issue was around for >2 years, I wonder how other people work around this... |
I spent a long time scratching my about this, and I've finally figured this out. I think it is best categorized as a "usage error", and not a true bug, though the documentation should certainly describe how to avoid the error. The problem comes down to whether CMake is properly being asked to "install" the tool, or just "build" it. I'm going to take the rdkafka-sys crate as an example, since that's what I'm most familiar with. Until recently, we were asking CMake to build the and then telling Rust to go find the library out of the In general, the approach of trying to figure out where CMake is going to generate files in the build tree is unworkable! CMake is best treated as a black box. While there is a CMake variable called The solution is to ask CMake to actually install the project, at which point CMake will make some promises to you. Libraries will go into If a particular project is not installing its libraries into CMAKE_INSTALL_PREFIX/lib, that is most definitely a bug in that project's CMake configuration and should be filed as such with the project. tl;dr if your project is calling |
1. use `#include "port/port.h"` instead of `#include "port/port_posix.h"` 2. added an "install" target for CMake to workaround rust-lang/cmake-rs#18 3. MSVC reported 2 warnings in Titan (and tons of warnings in RocksDB), and these are fixed.
1. use `#include "port/port.h"` instead of `#include "port/port_posix.h"` 2. added an "install" target for CMake to workaround rust-lang/cmake-rs#18 3. MSVC reported 2 warnings in Titan (and tons of warnings in RocksDB), and these are fixed.
thanks a lot for this explainer. I really think this crate should include an example cmakelists.txt for cmake noobs like me. |
Thx @benesch for the hint! so should you always install, for example static libraries to CMAKE_INSTALL_PREFIX/lib ? eg. like so, at the end of my cmakelists.txt:
this seems to work as well:
which one is preferable? Thanks!! |
here my build.rs
if I don't add "/build/Release". I get the following error
but it's work fine with it.
and on linux i need to add /build
It's a bug or I do it wrong ?
my cmake
The text was updated successfully, but these errors were encountered: