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

Jonatan Bijl jonatan.bijl at tba.nl
Tue Apr 28 10:22:37 EDT 2009


I've found the problem (and provide a solution, however in the tracker
some other changes are already being made in UseSWIG.cmake)
The problem is that because of relative path, an extra / was inserted.
This resulted in that the path to file that was marked as being
generated, was not identical to the path to the file that was needed.

Jonatan

-----Original Message-----
From: Tyler Roscoe [mailto:tyler at cryptio.net] 
Sent: 24 April 2009 17:28
To: Jonatan Bijl
Cc: cmake at cmake.org
Subject: Re: [CMake] swig: no rule to make target ***

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

-------------------------------------------------------------
This e-mail is intended exclusively for the addressee. If you
are not the addressee you must not read, copy, use or
disclose the e-mail nor the content; please notify us
immediately [by clicking 'Reply'] and delete this e-mail.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: useSwigPatch
Type: application/octet-stream
Size: 1821 bytes
Desc: useSwigPatch
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090428/62df7238/attachment.obj>


More information about the CMake mailing list