Dear CMakers,
  Sorry for disturbing. Since nobody gave the answer, I just rephrased the
title of my question.

  I am a beginner of CMake. My problem is that in MSVC, I have two projects:
one is executable project A, and the other is library project B. A depends
on B and A has to link B. I want A to link the corresponding B separately
under different configurations. For example, if I build Release version,
then A should link Release version of B, while if I build MinSizeRel
version, A should  link B in MinSizeRel/.

  For this purpose, I tried 2 ways but both failed. The first one is to set
dependency in CMake, however, CMake automatically set the property "Link
Library Dependencies" in the generated MSVC project to "No", which means it
won't link B automatically. Hence it seems I have to explicitly specify B as
a input library to A. So then I did this:

target_link_libraries(A debug Debug/B)
target_link_libraries(A optimized Release/B)

 Nevertheless, obviously, since optimized means all the other three
configurations except "Debug",  project A won't find library B if I directly
build "MinSizeRel" version because the compiler can not find library B in
directory Release/.

 So I am wondering, what is the standard way to do this? It will be great if
there is portable and unified way which is also working on Linux and Mac.

  Thanks in advance!

Best,
Meng
_______________________________________________
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