[cmake-developers] UseSWIG warns about CMP0057
felix schwitzer
felix.schwitzer at gmx.at
Thu Mar 26 17:16:42 EDT 2015
I have a library and use the "UseSWIG"-module to generate bindings for different
scripting languages from an interface file (ltt.i in the example below).
To get the bindings for more than one language, my CMakeLists.txt looks
somehow like
add_library(ltt <sources>)
include(UseSWIG)
foreach(_lang "ruby" "python")
if(_lang STREQUAL "ruby")
set(_modulename "rltt")
else()
set(_modulename "pltt")
endif()
swig_add_module(${_modulename} ${_lang} ltt.i)
swig_link_libraries(${_modulename} ltt)
endif()
Running this with cmake built from master (version 3.2.20150326-g5d1d99) now
gives
the warning about
Policy CMP0057 is not set: Disallow multiple MAIN_DEPENDENCY specifications
Is this a bug in UseSWIG or is my use case invalid?
If the latter, who can I workaround it?
The warning comes from UseSWIG in line 193; the interface file is added as
a MAIN_DEPENDENCY to the swig-generated wrapper file, and because of the loop,
it is added twice, to the lttPYTHON_warp.cxx and lttRUBY_warp.cxx,
the two swig-generated files.
Fixing this would be simple by adding the interface file as a normal dependency
to the wrapper-files, the only drawback is backward compatibility.
regards
Felix
More information about the cmake-developers
mailing list