<div class="gmail_quote">On Wed, Dec 1, 2010 at 10:59 AM, Kevyn-Alexandre Paré <span dir="ltr"><<a href="mailto:kapare@rogue-research.com">kapare@rogue-research.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Philip,<br>
<br>
Thx for the reply. Neither of these solutions change a thing.<br>
<br>
I try to play with ADD_CUSTOM_TARGET but same error...<br>
<br>
ADD_CUSTOM_TARGET(RRThread.o ALL COMMAND ${CMAKE_C_COMPILER} -I<br>
${MICRONTRACKER_COMMON_PATH} -I${GTEST_HEADER_PATH} -lpthread -c<br>
${MICRONTRACKER_COMMON_PATH}RRThread.c<br>
${UNIT_TEST_PATH}common/UT_RRThread.cc)<br>
<br>
ADD_CUSTOM_TARGET(UT_RRThread ALL COMMAND ${CMAKE_CXX_COMPILER} -I<br>
${MICRONTRACKER_COMMON_PATH} -I${GTEST_HEADER_PATH} -lpthread RRThread.o<br>
UT_RRThread.o ${GTEST_LIB_PATH}gtest.a ${GTEST_LIB_PATH}gtest_main.a -o<br>
UT_RRThread)<br>
<br>
Result:<br>
UT_RRThread.o: In function `thread_proc(void*)':<br>
<div class="im">UT_RRThread.cc:(.text+0x28): undefined reference to `exitThread()'<br>
</div>...<br>
<br></blockquote><div><br></div><div>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.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I pretty sure that I'm missing little detail. How can I implicitly add<br>
dependency to the object during the linking?<br></blockquote><div><br></div><div>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.</div>
<div><br></div><div>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.</div>
<div><br></div></div>-- <br>Philip Lowman<br>