[CMake] Unnecessary ordering breaks existing CMakeLists.txt

Dataflow dataflow at mtnl.net.in
Wed Aug 16 10:13:03 EDT 2006


Hi Bill,

This was working with 2.0 and feels natural, but no longer works with 2.4.
It boils down to the ordering of LINK_DIRECTORIES.
-------------
add_executable(app
    src1.cpp src2.cpp ...
    )
link_directories(dir1;dir2;dir3)
target_link_libraries(app lib1 lib2 lib3)
--------------

This now requires that the 'add_executable' should come between 'link_dirs' and 'target_link..'. This is unnecessarily restrictive. Any particular reason why CMake has been changed to impose this ?

PS:
I have reduced this from the general case of
-----------
add_executable(app ...)

find_package(...)
target_link_libraries(app lib1)

find_package(...)
target_link_libraries(app lib2)
etc
-----------
Now the add_executable must come after all the 'find_packages'.
Changing all the old CMakeLists is annoying. Even lowly make does not force this type of ordering.
Would like to keep package finding & its use at a single place.
Please clarify... 

Regards,
- Rajiv
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20060816/af70f135/attachment.html


More information about the CMake mailing list