0

Am trying to change default storage of the library, executable and include files to a specified directory in Cmake.

For e.g.: When I run Cmake, it will get build in a particular directory (where the source files are kept) and also generates the executables, libraries and include files in the same source directory. I want to define the output path for executables, libraries and include files in below structure.

X:\Builddirectory\lib\Debug\.... library files.
X:\Builddirectory\lib\Release\.... library files.
X:\Builddirectory\include\.... all the include files.
X:\Builddirectory\bin\.... executable files.

In order to perform the above, following CMake variables needs to be set.

But I am not aware how to edit these variables:

LIBRARY_OUTPUT_PATH
EXECUTABLE_OUTPUT_PATH 
PROJECT_BINARY_DIR 

may be some other variables as well.

Thanks for suggestions and help.

Florian
  • 39,996
  • 9
  • 133
  • 149
learner
  • 45
  • 2
  • 8
  • Can you edit the CMake file? – huu Sep 01 '15 at 02:42
  • First I think you should use "out source tree builds" as normally [recommended](http://stackoverflow.com/questions/4506193/what-are-the-dusty-corners-a-newcomer-to-cmake-will-want-to-know). So you call `cmake` from the `X:\Builddirectory` (see e.g. [here](http://stackoverflow.com/questions/18826789/cmake-output-build-directory)). And the rest would depend on what you want to do with libraries, executables and includes? If you like to reuse the output of one CMake project in another e.g. [this](https://coderwall.com/p/qej45g) article series could help (utilizing `export`/`install` commands). – Florian Sep 01 '15 at 07:03
  • There was a new related question posted I thought you might be interested in: [Parent CMakeLists.txt overwriting child CMakeLists.txt output directory options](http://stackoverflow.com/questions/32414587/parent-cmakelists-txt-overwriting-child-cmakelists-txt-output-directory-options). It's mainly about how to set the library/executable output directories in `CMake`. – Florian Sep 21 '15 at 20:22

1 Answers1

0

Once you open the CMAKE gui, Check for the above mentioned cmake variables, if they are not defined or defined with default path Consider performing the below mentioned. 1. If defined with default path then change it to the desired PATH 2. If the variable is not defined/assigned or could you not find in the CMAKE list then consider adding the variable by using "ADD Entry" option in the Gui.

learner
  • 45
  • 2
  • 8