I'm currently constructing a project with a plugin structure. I'm using CMake to compile the project. The plugins are compiled in separate directories. My problem is that CMake compiles and saves the binaries and plugins, dynamic libraries, in the directory structure of the source. How do I make CMake save the files in something like a ./bin directory?
相关问题
- Sorting 3 numbers without branching [closed]
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
- thread_local variables initialization
- What uses more memory in c++? An 2 ints or 2 funct
相关文章
- Class layout in C++: Why are members sometimes ord
- How to mock methods return object with deleted cop
- Which is the best way to multiply a large and spar
- C++ default constructor does not initialize pointe
- Call non-static methods on custom Unity Android Pl
- Selecting only the first few characters in a strin
- What exactly do pointers store? (C++)
- Converting glm::lookat matrix to quaternion and ba
Use
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "/some/full/path/to/bin")
Use the
EXECUTABLE_OUTPUT_PATH
CMake variable to set the needed path. For details, refer to the online CMake documentation:CMake 2.8.8 Documentation
As to me I am using cmake 3.5, the below(
set variable
) does not work:but this works(
set set_target_properties
):As in Oleg's answer, I believe the correct variable to set is CMAKE_RUNTIME_OUTPUT_DIRECTORY. We use the following in our root CMakeLists.txt:
You can also specify the output directories on a per-target basis:
In both cases you can append
_[CONFIG]
to the variable/property name to make the output directory apply to a specific configuration (the standard values for configuration areDEBUG
,RELEASE
,MINSIZEREL
andRELWITHDEBINFO
).use this line config :
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/build/)
place your any CMakeLists.txt project.
this ${PROJECT_SOURCE_DIR} is your current source directory where project place .
and if wander why is ${EXECUTABLE_OUTPUT_PATH}
check this file
CMakeCache.txt
then search the key wordoutput path
,all the variables define here , it would give a full explanation of the project all
setting·