[CMake] Test Shared Library Dependencies and set_tests_properties()

Nils Gladitz nilsgladitz at gmail.com
Mon May 12 03:41:30 EDT 2014


On 05/12/2014 09:10 AM, Jörg Kreuzberger wrote:
> For execution i therefore call set_test_properties( testname PROPERTIES ENVIRONMENT )
> with LD_LIBRARY_PATH on Linux and PATH for windows. This seems to work on linux for "cached" entries like e.g.  ${QT_LIBRARY_DIR} or others. If i want to add to add $<TARGET_FILE_DIR:othertarget> cmake seems not to resolve this path to an internaly build shard library dir.
>
> It just adds \$<TARGET_FILE_DIR:othertarget> to the test cmake file in the CMAKE_CURRENT_BINARY_DIR instead of resolving this path.

I think generator expressions in test properties are not supported in 
2.8.12.2 (current release).

Can you try with 3.0-rc4?

>
> On Windows i have the issue that i cannot set the path cause the semicolon is interpreted as list seperator
>
> e.g. set_test_properties( mytest PROPERTIES ENVIRONMENT "PATH=$ENV{PATH};${QT_LIBRARY_DIR}")
> How can i avoid this?

Escaping the semicolons should work.
e.g. (untested):

  string(REPLACE ";" "\;" ESCAPED_PATH "$ENV{PATH}")

  set_property(TEST mytest PROPERTY ENVIRONMENT
      "PATH=${ESCAPED_PATH}\;baz\;$<TARGET_FILE_DIR:foo>"
  )

Nils


More information about the CMake mailing list