CMAKE string comparison fails

Viewed 28809

I want to optionally add some library paths in my CMakeLists file and the way to do it to is to have a variable set as:

set(MYLIBDIR "DEFAULT")

If the user wants to specify a custom directory he will change it to:

set(MYLIBDIR /path/to/dir1
/path/to/dir2)

So in order to check if the user has indeed provided extra directories I check:

if(NOT ${MYLIBDIR} STREQUAL "DEFAULT")
 link_directories(${MYLIBDIR})
endif()

When I try to do this I am getting an error from cmake. Is there a way to concatenate all of the elements of a variable before the string comparison?

1 Answers
Related