Hi, Yuchen,
On Friday, September 07, 2012 08:43:02 AM Loaden wrote:
> Hi, list!
> I have a library target named 'TestLib', path is
> "./src/libs/testlib_src_dir'
> And now I made a execute named 'TestApp', path is './src/app'
>
> I try to link TestLib using:
> target_link_libraries(TestApp TestLib)
>
> My question:
> How to get the 'TestLib' target's source direcory (want get
> './src/libs/testlib_src_dir')?
>
> I read the documents, and want to using:
> get_target_properies(libdir TestLib XXX)
> in TestApp's CMakeLists.txt. But I can't get what is the XXX name?
>
> For now, I have to using:
> include_directory(../libs/testlib_src_dir) in TestApp's CMakeLists.txt.
> But I thought there possible exist an better way to solved my problem.
If you have in one CMakeLists.txt:
PROJECT( FOO )
ADD_LIBRARY( fooLibrary source.cpp )
then you can simply do in another CMakeLists.txt:
INCLUDE_DIRECTORIES( ${FOO_SOURCE_DIR} )
# "FOO" here comes from the PROJECT() line in the other CMakeLists.txt
> Sorry for my poor English.
> English is not my native language.
I've seen your English improve a lot over the last half year, so I would not
be sorry for that :-) Anyway, I'd guess it's at least about half (2/3?) the
world that doesn't speak English natively.
SaCu
--
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