[CMake] Invalid library output directory when VC++ solution is generated
J Decker
d3ck0r at gmail.com
Wed Jul 27 21:58:15 EDT 2011
Just as an alternative approach; instead of relying on having the code
in-place, generate appropriate install directives RUNTIME_, ARCHIVE_
and LIBRARY_ issues similar, needing basically a macro
my_install(target) if( WIN32) install( #what's correct for windows )
else( WIN32 ) install ( what's correct for other systems )... but
anyhow, then with a few more lines, you can use cpack to generate
installers.
Now, this means you can't just 'Set Active Project' and click F5 to
run it, but you can right-click on the project, set the debugging
properties of 'Target executable(?)'(first line) (there's a browse if
you click the drop arrow), and then copy the path part of that and
copy-paste to start-in directory(third line). Then you can run it,
without having to force the solution/project outputs to a specific
place.
2011/7/25 Laura Autón García <laura.auton at gmail.com>:
> Hello all,
> In the project I am collaborating on, CMake is used in Windows in
> order to generate a Visual C++ solution to be compiled afterwards. In
> this process, everything seems to work fine as the external
> directories and libraries are well included and everything compiles
> and so. However, we are experiencing problems with the directory in
> which our dll library is to be created.
> We specify in CMake that the directory is ../lib but
> when checking the configuration in Visual C++ software, it seems to be
> ../bin/Release directory, so the library is generated there.
> The CMake sentences we wrote regarding this issue are as follows:
>
> SET(LIB_DIR "${PROJECT_SOURCE_DIR}/lib")
> SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIB_DIR} CACHE PATH "Directory
> for libraries")
>
> According to the documentation:
>
> CMAKE_LIBRARY_OUTPUT_DIRECTORY: Where to put all the LIBRARY
> targets when built.
> This variable is used to initialize the LIBRARY_OUTPUT_DIRECTORY
> property on all the targets.
> See that target property for additional information.
>
> Also, the documentation regarding LIBRARY_OUTPUT_DIRECTORY shows:
>
> LIBRARY_OUTPUT_DIRECTORY: Output directory in which to build
> LIBRARY target files.
> This property specifies the directory into which library target
> files should be built. There are three
> kinds of target files that may be built: archive, library, and
> runtime. Executables are always treated
> as runtime targets. Static libraries are always treated as archive
> targets. Module libraries are always
> treated as library targets. 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. All Windows-based
> systems including Cygwin are
> DLL platforms. This property is initialized by the value of the variable
> CMAKE_LIBRARY_OUTPUT_DIRECTORY if it is set when a target is created.
>
> However, when the project is generated, the library output directory
> is not the one specified, but the one I mentioned above.
> If anyone has any idea why this may be happening, it would be appreciated.
> The binaries, on the other hand, as generated in their correct directory.
>
> Thank you in advance.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
More information about the CMake
mailing list