[CMake] Problems with LIBRARY_OUTPUT_PATH

Lars Pechan lars.pechan at parkerpechan.com
Thu Apr 14 01:16:52 EDT 2005


Hi there,
I have a very similar problem to this. Basically, I use a long chain of 
custom commands to generate a resource-file which is subsequently used 
for building a shared lib. The generated res-file has the GENERATED 
source file property set to true (as do some of the others in the 
chain).

The lib line is akin to this:

ADD_LIBRARY(LibA $GenDir}/${GenResFile} dllDummy.c)

This builds nicely BUT the problem is that it always builds. I would 
have thought that if ${LIBRARY_OUTPUT_PATH}/LibA.dll exists there is no 
need to rebuild it. Similarly, if both $GenDir}/${GenResFile} 
dllDummy.c exist, I thought that all that's needed is to link the thing 
rather than running the whole chain again.

Interestingly, the output of nmake when building the lib ends with:

Linking C shared library ..\..\..\..\..\libA.dll
LINK: LNK6004: ..\..\..\..\..\libA.dll not found or not built by the 
last incremental link; performing full link

This message is displayed regardless of whether ..\..\..\..\..\libA.dll 
exists.

I set up a little test project to try and present a minimum case where 
this goes wrong but my test case just confirms what I'm guessing above, 
i.e. that if libA exists nothing happens and if libA doesn't exist but 
its dependencies are up-to-date it will just link it rather than 
starting by regenerating the file marked GENERATED. Notably, I don't 
get the linker message for the smaller test case. The small test case 
is, ahem, small and my real project is huge so perhaps the problem is 
with the length of paths etc?

After reading about Felipes issue I made sure I only set 
LIBRARY_OUTPUT_PATH once for the whole project but the problem remains.

Any ideas?

Regards,

/Lars

PS. CMakeCVS-20050331 generating nmake makefiles for out-of-source 
builds on WinXP with VS.NET 2003.

On 10/01/2005, at 11:08 PM, Filipe Sousa wrote:

> Hi!
>
> When I set LIBRARY_OUTPUT_PATH in sub directories, cmake is always 
> building
> the libraries. To a better understanding of my problem I show you my
> CMakeLists.txt files
>
> In my project root I have this CMakeList.txt
> PROJECT(gal)
> SUBDIRS(mylib modules)
>
> 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)
>
> CMakeLists.txt to build a simple plug-in that links with "mylib". All 
> plugins
> should go ${PROJECT_BINARY_DIR}/plugin
>
> ADD_LIBRARY(mod MODULE m.cc)
> SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/plugin)
> LINK_DIRECTORIES(${PROJECT_BINARY_DIR}/lib)
> TARGET_LINK_LIBRARIES(mod mylib)
>
> Everytime I run make, the plugin is always built as you can see by the 
> output:
>
> fsousa at localhost ~/tmp/cmakebug/Build $ make
> cmake.depends is up-to-date
> /home/fsousa/tmp/cmakebug/Build/mylib: building default_target
> cmake.depends is up-to-date
> /home/fsousa/tmp/cmakebug/Build/modules: building default_target
> cmake.depends is up-to-date
> cmake.depends is up-to-date
> Building shared module 
> /home/fsousa/tmp/cmakebug/Build/plugin/libmod.so...
>
> fsousa at localhost ~/tmp/cmakebug/Build $ make
> cmake.depends is up-to-date
> /home/fsousa/tmp/cmakebug/Build/mylib: building default_target
> cmake.depends is up-to-date
> /home/fsousa/tmp/cmakebug/Build/modules: building default_target
> cmake.depends is up-to-date
> cmake.depends is up-to-date
> Building shared module 
> /home/fsousa/tmp/cmakebug/Build/plugin/libmod.so...
>
> Is this a bug or am I doing something wrong?
>
> --
> Filipe Sousa
>
> _______________________________________________
> CMake mailing list
> CMake at www.cmake.org
> http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list