Skip to content

CMake fails when $NTA and $NUPIC are both empty #755

@utensil

Description

@utensil

In README.md:

After CMake generation, two useful environment variables will be created:

  • $NUPIC, which is the same as $REPOSITORY
  • $NTA, which references $HOME/nta/eng (the directory with all executables and libraries generated from build process). If this variable is already set, the $REPOSITORY/release will not be created, and $NTA will be used as the release directory.

This is an usability improvement compared to the old "set $NUPIC and $NTA yourself or the build fails" approach, providing sane defaults in the spirit of 2014 Goals For NuPIC: Easy install, easy build.

But when $NTA and $NUPIC are both empty, cmake $REPOSITORY complains:

CMake Error at CMakeLists.txt:181 (message):
  $NTA environment variable cannot be the same as the $NUPIC environment
  variable!


-- Configuring incomplete, errors occurred!

In CMakeLists.txt:181, it reads:

#
# Cannot have same $NTA and $NuPIC
#
if("$ENV{NTA}" STREQUAL "$ENV{NUPIC}")
  message(FATAL_ERROR "\$NTA environment variable cannot be the same as the \$NUPIC environment variable!")
endif()

This logic fixes #659 , but is in contradiction to with the statements in README.md, which implemented around CMakeLists.txt:436:

set_environment_variable(NUPIC "${PROJECT_SOURCE_DIR}" OFF)
...
if("$ENV{NTA}" STREQUAL "")
  set_environment_variable(NTA "${CMAKE_INSTALL_PREFIX}" OFF)

Thus, as long as they are not both empty, defaults would work.

And I noticed in .travis.yml, $NUPIC and $NTA are declare in env.global, and I guess most nupic developers already have them configured, that's why it's not spotted.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions