Building from source in Ubuntu, it thinks I have swig2.0 when I have swig 4.0

I tried adding swig4.0:

find_program(SWIG_EXECUTABLE NAMES swig4.0 swig3.0 swig2.0 swig)

This made no difference. So I did a crude hack which works fine instead: I just forced it to be set to where I know the 4.0 binary is (via set(SWIG_EXECUTABLE /usr/local/bin/swig) below). We need a better solution but for now this works I guess. The commented out lines are other things I tried that didn’t work.

# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

find_program(SWIG_EXECUTABLE NAMES swig3.0 swig2.0 swig)
# find_program(SWIG_EXECUTABLE NAMES swig4.0 swig3.0 swig2.0 swig)
# find_program(SWIG_EXECUTABLE NAMES swig swig3.0 swig2.0 PATHS usr/local/share NO_CMAKE_FIND_ROOT_PATH)
# find_program(SWIG_EXECUTABLE NAMES swig PATHS /usr/local/bin NO_DEFAULT_PATH NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_PATH NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH NO_CMAKE_FIND_ROOT_PATH)

# message("hey " ${SWIG_EXECUTABLE})
set(SWIG_EXECUTABLE /usr/local/bin/swig)
# message("hey " ${SWIG_EXECUTABLE})

if(SWIG_EXECUTABLE)
  execute_process(COMMAND ${SWIG_EXECUTABLE} -swiglib

I’m using Ubuntu 14.04. This machine has unique build dependencies and cannot be upgraded to a later version of Ubuntu at this time.