How to specify the path for .lib files in cmake?

cmake, visual-studio

Solution

Quoting from the CMake docs:

For DLL platforms the DLL part of a shared library is treated as a runtime target and the corresponding import library is treated as an archive target.

So instead of setting `LIBRARY_OUTPUT_DIRECTORY` or `CMAKE_LIBRARY_OUTPUT_DIRECTORY` you need to set `ARCHIVE_OUTPUT_DIRECTORY` or `CMAKE_ARCHIVE_OUTPUT_DIRECTORY` (one of the two suffices).

Problem

I am trying to build a project with `cmake`. In that i mentioned seperate folders for `.dll` and `.lib`. Dll's are created in the folder which i mentioned but `.lib` files are not generated in the folder which i mentioned. Please give a solution for this problem. The command which i used in `cmakelists.txt` is : ``` set(CMAKE_LIBRARY_OUTPUT_DIRECTORY My_Lib) SET_TARGET_PROPERTIES(MyApi PROPERTIES LINKER_LANGUAGE CPP RUNTIME_OUTPUT_DIRECTORY My_Binary LIBRARY_OUTPUT_DIRECTORY My_Lib) ```

Original source