[CMake] swig: no rule to make target ***

Tyler Roscoe tyler at cryptio.net
Fri Apr 24 11:27:41 EDT 2009


On Fri, Apr 24, 2009 at 10:40:51AM +0200, Jonatan Bijl wrote:
> #Generates a swig library.
> 
> function(compile_directory_to_swig DIRECTORY_PATH)
> 
>     if(NOT SWIG_FOUND)
> 
>         find_package(SWIG REQUIRED)
> 
>         include(${SWIG_USE_FILE})
> 
>         set(SWIG_CXX_EXTENSION "cpp")
> 
>         set(CMAKE_SWIG_FLAGS "")        
> 
>     endif(NOT SWIG_FOUND)
> 
>     file(GLOB CPP_FILES "${DIRECTORY_PATH}/*.cpp")

Don't know anything about SWIG but I have a guess: do those generated
.cpp files exist when the above file(GLOB) is run? If not, then CMake
won't know about those files and thus can't add them to the list of
sources to be compiled, GENERATED flag or not.

Also, it is a CMake best practice to use explicit lists rather than
file(GLOB) to collect lists of sources. Consult the docs/archives for
details.

tyler


More information about the CMake mailing list