[CMake] Makefile to CMakeLists.txt (GTEST)
Philip Lowman
philip at yhbt.com
Sat Dec 4 05:48:24 EST 2010
On Wed, Dec 1, 2010 at 10:59 AM, Kevyn-Alexandre Paré <
kapare at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20101204/e87d1d64/attachment.htm>
More information about the CMake
mailing list