Am 03.11.2011 12:42, schrieb Hendrik Sattler:
Am 03.11.2011 12:26, schrieb John R. Cary:
Feels like I am doing something wrong.

Looking for multiple libraries:

$ cat CMakeLists.txt
set(mylibdir /contrib/netcdf-4.1.2-ser/lib)
foreach (name netcdf_c++ netcdff netcdf)
  message("Looking for ${name} in ${mylibdir}.")
find_library(mylib NAMES ${name} PATHS ${mylibdir} NO_DEFAULT_PATH)
  if (mylib)
    message("Found: ${mylib}.")
    list(APPEND mylibs ${mylib})
  else ()
    message("Not found.")
  endif ()
endforeach ()

But continues to find the first each time:

From the documentation:
"A cache entry named by <VAR> is created to store the result of this
command. If the library is found the result is stored in the variable
and the search will not be repeated unless the variable is cleared."

Note that clearing the variable is NOT the suggested way, instead use a name that depends on the loop-item.

HS

--

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

Reply via email to