title: Trouble setting environment variables for CTest tests
body: <p>I'm tasked with building python bindings for a c++-based project (using swig). The project uses cmake to build and ctest to test and the build and test of the bindings are supposed to be integrated into this.</p>
  
  <p>I've gotten the build to work and the tests work when run manually, but I have to set a couple of environment variables in order for them to work and I'm having trouble setting those for the automated process. </p>
  
  <p>I need to set LD_LIBRARY_PATH and PYTHONPATH. PYTHONPATH I can get around by manipulating sys.path within the testing script, but that's harder to do with LD_LIBRARY_PATH. So far I have the following added to the CMakelists.txt in the testing directory:</p>
  
  <pre><code>#Python wrapper testing
  
  find_package(PythonInterp 3.5 REQUIRED)
  
  if (NOT PYTHONINTERP_FOUND)
    message(STATUS "Python interpreter NOT found")
  else(NOT PYTHONINTERP_FOUND)
    message(STATUS "Python interpreter found")
    ADD_TEST(NAME testPyMyproj
         COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_scripts/test_pyMyproj.py
         )
    set_property(TEST testPyMyproj PROPERTY ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib/)
  endif (NOT PYTHONINTERP_FOUND)
  </code></pre>
  
  <p>The error I am getting is </p>
  
  <pre><code>ImportError: libMyproj.so: cannot open shared object file: No such file or directory
  </code></pre>
  
  <p>Which is the library my bindings are linked to and is in the directory specified by <code>${CMAKE_BINARY_DIR}/lib/</code>. </p>
  
  <p>I take this to mean that <code>$LD_LIBRARY_PATH</code> is not set correctly, but I don't know what I'm doing wrong. </p>
  
  <p>Is there a way to check within the test what the state of the variable is? Can anyone spot what I am doing wrong?</p>