CNS-OIST / STEPS

Public release repository for STochastic Engine of Pathway Simulation (STEPS)
http://steps.sourceforge.net
Other
38 stars 10 forks source link

CMake does not halt when SWIG is missing #3

Closed mcraveiro closed 7 years ago

mcraveiro commented 7 years ago

Hi STEPS developers,

I just noticed a minor bug on your build system: even though SWIG is marked as required, CMake still goes ahead and generates all the makefiles:

<snip>
-- Looking for strip utility
-- Looking for strip utility - found
-- Could NOT find SWIG (missing:  SWIG_EXECUTABLE SWIG_DIR) 
-- Found PythonInterp: /usr/bin/python (found version "2.7.13") 
-- Found PythonInterpLibs: /usr/lib/x86_64-linux-gnu/libpython2.7.so  
-- Found MPI_C: /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi.so  
<snip>
-- Build files have been written to: /home/marco/Development/phd/STEPS_Release/output

The normal CMake behaviour is to bomb out when a required dependency is missing. I am investigating as to why this is not working correctly, your CMake files look fine at first glance.

WeiliangChenOIST commented 7 years ago

Hi @FrancescoCasalegno , could you or someone from BBP take a look at this issue please?

mcraveiro commented 7 years ago

Actually @WeiliangChenOIST before you guys waste your time, let me just have a quick go - I think this may be a CMake thing rather than your code; your usage of CMake looks fine. I am testing it with a different library to see if there is something wrong with my CMake version (3.7.2 on Debian unstable).

mcraveiro commented 7 years ago

Ok interesting so my test reveals that my CMake version works fine. On a totally separate project, using standard SWIG from CMake:

find_package(SWIG REQUIRED)

I get the expected error:

CMake Error at /usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake:138 (message):
  Could NOT find SWIG (missing: SWIG_EXECUTABLE SWIG_DIR)
Call Stack (most recent call first):
  /usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.7/Modules/FindSWIG.cmake:63 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:95 (find_package)

-- Configuring incomplete, errors occurred!
See also "/home/marco/Development/DomainDrivenConsulting/dogen/build/output/gcc/Release/CMakeFiles/CMakeOutput.log".
See also "/home/marco/Development/DomainDrivenConsulting/dogen/build/output/gcc/Release/CMakeFiles/CMakeError.log".
Error running CMake.

The plot thickens. There is something not quite right with your CMake file. Investigating some more...

FrancescoCasalegno commented 7 years ago

I found the bug: REQUIRED was not implemented properly in CMake/FindSWIG3.cmake. I will send a pull request in 5 minutes.

mcraveiro commented 7 years ago

Ah most interesting - will be very curious to see the patch! grazie mille @FrancescoCasalegno