On 11/15/2011 3:54 PM, Alexander Neundorf wrote:
Maybe you'll prefer a more map-like implementation ?
Yes.
I don't like the function because it pollutes the global namespace of
functions. I took great care to design imported targets so they only
affect a directory namespace. They are very lightweight and have no
effects outside the reporting directory.
Someday I'd like to scope macros and functions too but that will be
another policy/compatibility nightmare.
list(APPEND _check_targets foo)
set(_filesToCheck_foo libfoo.dll libfoo.lib)
...
list(APPEND _check_targets bar)
set(_filesToCheck_bar libbar.dll libbar.lib)
...
foreach(target ${_check_targets} )
foreach(file ${_filesToCheck_${target}})
if (NOT EXISTS ${file})
message(FATAL_ERROR "...")
endif()
endforeach()
+ unset(_filesToCheck_${target})
endforach()
+ unset(_check_targets)
That looks good. Just add the lines I show above starting in '+' so that
the export() command's APPEND mode does not accumulate and repeat checks,
and so that the variables are left clean at the end of the import. Also,
I think the variable names should be
_IMPORT_CHECK_TARGETS
_IMPORT_CHECK_FILES_IN_${target}
to match the _IMPORT_PREFIX convention already used.
Thanks,
-Brad
--
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://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers