Not sure if this is recommended or not with CMake 2.8 BUT:

[mjack...@ferb]$ cmake --help-command link_directories
cmake version 2.6-patch 4
------------------------------------------------------------------------------
SingleItem

  link_directories
       Specify directories in which the linker will look for libraries.

         link_directories(directory1 directory2 ...)

Specify the paths in which the linker should search for libraries. The command will apply only to targets created after it is called.
       For historical reasons, relative paths given to this command are
       passed to the linker unchanged (unlike many CMake commands which
       interpret them relative to the current source directory).



set (CMAKE_BUILD_TYPE "Config-1")
link_directories ( ${SOME_SOURCE_DIR}/${CMAKE_BUILD_TYPE} )
include (${SOME_SOURCE_DIR}/${CMAKE_BUILD_TYPE}/Libraries.cmake)

add_executable(MyExe ${srcs})
target_link_libraries(MyExe ${MyLinkLibraries})

#--- Libraries.cmake file
set (MyLinkLibraries "Somelib1 SOmeLib2")

Thoughts/comments from the community?
___________________________________________________________
Mike Jackson                      www.bluequartz.net
Principal Software Engineer       mike.jack...@bluequartz.net
BlueQuartz Software               Dayton, Ohio


On Apr 1, 2010, at 2:52 PM, Benoit Thomas wrote:

Hello,

I'm trying to find a work around since target_link_libraries cannot be used per-configuration. I know that out-of-build could solve my problem, but my team is currently migrating from Visual Studio to cmake, so I need something which "feel" more like Visual Studio.

My current project has around 20 configurations (debug, release, many many more, mostly combination of debug_something, release_something, etc.) and some of those configuration requires to include special external libraries, some not. Since I cannot classify all my configurations as debug or release, solution like target_link_libraries (target my_library debug|optimized) did not work.

To put it simply, what I'm trying to achieve is something like:

add_executable (exec)
add_library (my_lib)

set_target_properties (exec PROPERTIES COMPILE_DEFINITIONS_CONFIG1 USING_MY_LIB) set_target_properties (exec PROPERTIES COMPILE_DEFINITIONS_CONFIG2 NOT_USING_MY_LIB)

# should only link the library under CONFIG1
target_link_libraries (exec my_library)

Thank you,
Ben.

_______________________________________________
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

_______________________________________________
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

Reply via email to