Thx for replying, It seem that my simple example and using a add_subdirectory and reusing CMakelists.txt of the gtest source solved my problem.
Regards, On Sat, 2010-12-04 at 05:48 -0500, Philip Lowman wrote: > On Wed, Dec 1, 2010 at 10:59 AM, Kevyn-Alexandre Paré > <kap...@rogue-research.com> wrote: > Philip, > > Thx for the reply. Neither of these solutions change a thing. > > I try to play with ADD_CUSTOM_TARGET but same error... > > ADD_CUSTOM_TARGET(RRThread.o ALL COMMAND ${CMAKE_C_COMPILER} > -I > ${MICRONTRACKER_COMMON_PATH} -I${GTEST_HEADER_PATH} -lpthread > -c > ${MICRONTRACKER_COMMON_PATH}RRThread.c > ${UNIT_TEST_PATH}common/UT_RRThread.cc) > > ADD_CUSTOM_TARGET(UT_RRThread ALL COMMAND > ${CMAKE_CXX_COMPILER} -I > ${MICRONTRACKER_COMMON_PATH} -I${GTEST_HEADER_PATH} -lpthread > RRThread.o > UT_RRThread.o ${GTEST_LIB_PATH}gtest.a > ${GTEST_LIB_PATH}gtest_main.a -o > UT_RRThread) > > Result: > UT_RRThread.o: In function `thread_proc(void*)': > UT_RRThread.cc:(.text+0x28): undefined reference to > `exitThread()' > > ... > > > > I'm not sure what exactly has gone wrong here. You might want to try > to find the exitThread symbol to see where it lives using "nm" or > "strings" on the libraries that you have. If all else fails, perhaps > check on a GTest forum? I've never had this problem before but I > don't recall ever using the gtest static libraries either. > > I pretty sure that I'm missing little detail. How can I > implicitly add > dependency to the object during the linking? > > > I don't see anything wrong with what you have in terms of the GCC > invocation. You'll need to explicitly specify the libraries during > compile time to resolve those symbols and produce a binary as far as I > know. > > > I'm not sure why you're using add_custom_target() when you could just > use add_executable() and target_link_libraries(), but I doubt this has > anything to do with your undefined symbol reference. > > > -- > Philip Lowman _______________________________________________ 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