[CMake] Problems with LIBRARY_OUTPUT_PATH

Brad King brad.king at kitware.com
Mon Jan 10 10:24:30 EST 2005


Filipe Sousa wrote:
> CMakeLists.txt to build "mylib". I want to put all libraries in the same 
> directory
> 
> ADD_LIBRARY(mylib mylib.cc)
> SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
[snip]
> ADD_LIBRARY(mod MODULE m.cc)
> SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/plugin)
[snip]
> Everytime I run make, the plugin is always built as you can see by the output:
[snip]
> Is this a bug or am I doing something wrong?

LIBRARY_OUTPUT_PATH is meant to be set by the user of CMakeSetup in the 
cache.  There should be only one value and it should be used for the 
entire build tree.  What is happening to you is that a library that 
depends on libmod expects to see it in one place according to 
LIBRARY_OUTPUT_PATH, but the directory that builds it has a different 
setting for LIBRARY_OUTPUT_PATH.  Therefore the library that wants 
libmod never finds it where it expects to see it because it always gets 
built somewhere else.

Right now I don't think there is a way to have a per-directory output 
path.  A library is built either in the build tree directory 
corresponding to the source tree directory containing its ADD_LIBRARY 
command or it is build in the LIBRARY_OUTPUT_PATH.  You can submit a 
feature request to the bug tracker:

http://www.cmake.org/Bug

but I don't know when we can get to investigating it.

-Brad


More information about the CMake mailing list