TALP-UPC / FreeLing

FreeLing project source code
Other
252 stars 96 forks source link

Unknown CMake command “SWIG_ADD_LIBRARY”. #98

Open pmchozas opened 4 years ago

pmchozas commented 4 years ago

Hi, I’m trying to build the python3 library on MacOS with -DPYTHON3_API=ON but I get this error all the time.

CMake Error at CMakeLists.txt:12 (SWIG_ADD_LIBRARY): Unknown CMake command “SWIG_ADD_LIBRARY”.

I’ve seen that was a common error with previous cmake versions, but I'm using 3.17 I still get it. Could you please help me solve this? thanks!!

pmchozas commented 4 years ago

Hi again, I solved it by adding

find_package (SWIG)

include (UseSWIG)

to CmakeLists.txt

But now I get this error:

CMake Error at CMakeLists.txt:25 (install):
  install TARGETS given target "_pyfreeling" which does not exist.

Could you help me with this as well ?

lluisp commented 4 years ago

It looks as it has to do with the Cmake version. The isntructions were already there, in APIs/CMakeLists.txt;

find_package(SWIG REQUIRED)
include(${SWIG_USE_FILE})

The provided files work for me with Cmake 3.10 to 3.13. I have not tried more recent versions.
You may try downgrading your cmake version.