On 03/20/2014 11:19 PM, Perkins, Jim R CIV NSWC, PCD wrote:
I am using CMake 2.8.12.2 to create a Visual Studio 12 (2013) project that
builds a library (C++). In my CMake file (an example project for simplicity),
I have:
ADD_LIBRARY(testcmake SHARED ${SRC})
The only thing I cannot get to work is the CMAKE_LIBRARY_OUTPUT_DIRECTORY variable. No matter what
I try (including other possible CMake variables), it does not get translated to the "Output
Directory" field in Visual Studio when building a project. My library is always placed inside
of testcmake\build\Debug, when I want it in ${CMAKE_CURRENT_LIST_DIR}. I can manually change the
"Output Directory" inside Visual Studio and the library outputs to the wanted location,
but if I ever modify the CMakeLists file it breaks again, so that is not a solution.
To quote the documentation:
"For non-DLL platforms shared libraries are treated as library targets.
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 for windows you might want to look at the related variables
CMAKE_RUNTIME_OUTPUT_DIRECTORY and CMAKE_ARCHIVE_OUTPUT_DIRECTORY.
For multi-configuration generators (like the Visual Studio generators) a
configuration dependent directory will get appended automatically (e.g.
Debug or Release).
If you do not want these you can look at the config specific target
properties; e.g. RUNTIME_OUTPUT_DIRECTORY_<CONFIG>:
http://www.cmake.org/cmake/help/git-master/prop_tgt/RUNTIME_OUTPUT_DIRECTORY_CONFIG.html
Nils
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake