diff --git a/CMakeLists.txt b/CMakeLists.txt index c35b8507fd..85dc3cd3d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -521,6 +521,7 @@ if(NRN_ENABLE_CORENEURON) get_property(CORENRN_LIB_LINK_FLAGS GLOBAL PROPERTY CORENRN_LIB_LINK_FLAGS) get_property(CORENRN_NEURON_LINK_FLAGS GLOBAL PROPERTY CORENRN_NEURON_LINK_FLAGS) get_property(CORENRN_ENABLE_SHARED GLOBAL PROPERTY CORENRN_ENABLE_SHARED) + get_property(CORENRN_NMODL_BINARY GLOBAL PROPERTY CORENRN_NMODL_BINARY) # NEURON tests that link against CoreNEURON need to depend on it. set(CORENEURON_TARGET_TO_DEPEND coreneuron-for-tests) diff --git a/src/coreneuron/CMakeLists.txt b/src/coreneuron/CMakeLists.txt index 2552c80abd..561b9896e3 100644 --- a/src/coreneuron/CMakeLists.txt +++ b/src/coreneuron/CMakeLists.txt @@ -283,8 +283,8 @@ else() FILES ${NMODL_PROJECT_BINARY_DIR}/share/nmodl/nrnunits.lib DESTINATION share/nmodl COMPONENT nrnunits) - endif() +set_property(GLOBAL PROPERTY CORENRN_NMODL_BINARY "${CORENRN_NMODL_BINARY}") # set correct arguments for nmodl for cpu/gpu target set(CORENRN_NMODL_FLAGS diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index c1e5411f03..86d011562b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -655,8 +655,10 @@ if(NRN_ENABLE_PYTHON) NAME test_nmodlrandom_syntax_py_${processor} REQUIRES coreneuron ${processor} ${modtests_preload_sanitizer} SCRIPT_PATTERNS test/coreneuron/test_nmodlrandom_syntax.py - ENVIRONMENT ${modtests_processor_env} ${nrnpython_mpi_env} - COVERAGE_FILE=.coverage.coreneuron_test_nmodlrandom_syntax_py + ENVIRONMENT + ${modtests_processor_env} ${nrnpython_mpi_env} + COVERAGE_FILE=.coverage.coreneuron_test_nmodlrandom_syntax_py + NMODL_BINARY=${CORENRN_NMODL_BINARY} COMMAND ${modtests_launch_py} test/coreneuron/test_nmodlrandom_syntax.py) nrn_add_test( GROUP coreneuron_modtests diff --git a/test/coreneuron/test_nmodlrandom_syntax.py b/test/coreneuron/test_nmodlrandom_syntax.py index 1dbe14ec61..9e04092a7b 100644 --- a/test/coreneuron/test_nmodlrandom_syntax.py +++ b/test/coreneuron/test_nmodlrandom_syntax.py @@ -1,6 +1,7 @@ from neuron import h import subprocess from pathlib import Path +import os # default args generate accepted nmodl string @@ -75,7 +76,9 @@ def chk_nmodl(txt, program="nocmodl", rcode=False): def test_syntax(): - for program in ["nocmodl", "nmodl"]: + # nmodl could be external installation (not in PATH) + nmodl_binary = os.environ.get("NMODL_BINARY", "nmodl") + for program in ["nocmodl", nmodl_binary]: foo = False assert chk_nmodl(modfile(), program, rcode=True) assert chk_nmodl(modfile(s0="ASSIGNED{rv1}"), program)