[CMake] LIBRARY_OUTPUT_DIRECTORY problem with out of source builds

Adil Yalcin adil.yalcin at gmail.com
Sun Feb 7 08:03:15 EST 2010


Hello,

I am using CMake 2.6. I have the following problem with the generator set as
Visual Studio 8 2005.

The related statements in my CMakeLists file (Notice that the library and
runtime directories are in source directory explicitly:

ADD_LIBRARY(MyLib_Shared SHARED ${MyLib_sources} )

SET_TARGET_PROPERTIES(MyLib_Shared
    PROPERTIES
        RELEASE_POSTFIX _r
        LIBRARY_OUTPUT_DIRECTORY ${MYLIB_SOURCE_DIR}/lib
        RUNTIME_OUTPUT_DIRECTORY ${MYLIB_SOURCE_DIR}/lib
)

However, when I compile the project, <MyLib>_Shared_r.lib is not created in
the folder I specified : <sourcedir>/lib/release/MyLib_Shared_r.lib
It is instead created in the default directory in the build path, like
<builddir>/main/release/MyLib_Shared_r.lib.
However, The runtime outputs are correctly placed under the directory i
specified: <sourcedir>/lib/release, with name MyLib_Shared_r.dll .

Consequently, when I try to link this shared library from an application,
using TARGET_LINK_LIBRARIES( MyApp MyLib_Shared ), it incorrectly generates
a vs project file that tries to include
..\..\main\Release\MyLib_Shared_r.lib (thus a file not found error). It
should be <sourcedir>/lib/release/MyLib_Shared_r.lib, or
..\..\lib\Release\MyLib_Shared_r.lib

All I really want to do is to perform out-of-source builds of my library,
which creates libraries/binaries "inside" the source directory, which are
then linked by the applications within the source directory. I want the
binaries to be inside the source directory, since the source directory holds
some relatively large files that are loaded by the applications.

Am I missing an important point in my CMakeLists files, or is this a known /
fixed bug ?

Any help would be much appreciated. Thanks,

-- 
M. Adil Yalcin
Bilkent University - Computer Engineering
http://www.cs.bilkent.edu.tr/~yalcin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100207/8793f76e/attachment.htm>


More information about the CMake mailing list