[CMake] Path to installed target

Eric Noulard eric.noulard at gmail.com
Wed Jan 12 08:01:26 EST 2011


2011/1/12 Alexey Livshits <livchits at web.de>:
>> Yes, make the tests run without installation. To give more advice, we'd
>> need to know more about those "dependencies". Are they other
>> executables? Data files? Libraries?
>
> Well, if I could do that, I wouldn't ask ;)
> I have 2 versions, which are built from the same sources. So I have to
> have 2 different output directories. Some shared libraries are built
> only for one version, but needed for both. CMake install process helps
> perfectly here.

If the two "version" are needed you may build them in a single build.

add_library(libv1 ${LIB_SRC})

add_library(libv2 ${LIB_SRC})
set_target_properties(libv2 PROPERTIES COMPILE_FLAGS "-DV2")

add_executable(t1 t1.c)
target_link_libraries(t1 libv1)
add_executable(t2 t2.c)
target_link_libraries(t2 libv2)
add_executable(t3 t3.c)
target_link_libraries(t3 libv1 libv2)

so that in the same build you have the 2 versions you can directly use
with add_test.

add_test(Test1 t1)
add_test(Test2 t2)
add_test(Test3 t3)

but may be I'm missing something about your "2 versions"?

> Some tests require shared libraries from both versions. So I created
> the new install component for tests, but I cannot address them for
> CTest.

Alternatively, may be you can decide that your needed
"temporary" install will always be in a fixed location relative to the
build tree:

${CMAKE_BINARY_DIR}/tempinstall/
then you always know where are installed the lib, executable etc...

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list