thank you very much Bill, it works now!
Is it a big deal if I let the lib A where you advise me to remove it?
Le 16/03/2010 22:49, Bill Hoffman a écrit :
AKHRES Nader wrote:
Hello CMake community,
I've two libs A and B where B depends on A.
Then I have my final exe which depends on A and B.
When I generate exe project for gcc or mingw, I get undefined
reference errors from B.
This doesn't happen with visual c++.
Here are my cmake files organization, with relevant content between
bracket:
root
|--myAlib
|--------CMakeLists.txt [ADD_LIBRARY(A STATIC sources)]
|--myBlib
|--------CMakeLists.txt [INCLUDE_DIRECTORIES(myAlib/src)
ADD_LIBRARY(B STATIC src)]
target_link_libraries(B A) # add this
|--myExe
|--------CMakeLists.txt [ADD_EXECUTABLE(exename src)
TARGET_LINK_LIBRARIES(exename B) ] # you can remove A from here
|--CMakeLists.txt [ADD_SUBDIRECTORY(myAlib) ADD_SUBDIRECTORY(myBlib)
ADD_SUBDIRECTORY(myExe)]
Maybe it's something obvious I've forgotten...
_______________________________________________
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