title: Proper way to use platform specific separators in cmake
body: <p>I wonder if there is a better solution to my problem. I am working on a platform independent software project and want to add python-based unittests to cmake. The issue that I encountered now is that when configuring the ctest tests and setting up the correct PYTHONPATH environment variable for running my test, I end up with a lot of boilerplate code for each test:</p>
  <pre><code>add_test(my_awesome_test ${PYTHON_EXECUTABLE} my_awesome_test.py)
  
  if(&quot;${CMAKE_HOST_SYSTEM}&quot; MATCHES &quot;.*Windows.*&quot;)
    set_tests_properties(my_awesome_test PROPERTIES ENVIRONMENT &quot;PYTHONPATH=somepath\;anotherpath&quot;)
  else() # e.g. Linux
    set_tests_properties(my_awesome_test PROPERTIES ENVIRONMENT &quot;PYTHONPATH=somepath:anotherpath&quot;)
  endif()
  
  # more tests like this after this...
  </code></pre>
  <p>The problem here is the branching, that is required only because of the platform dependent list separators.</p>
  <p><strong>Is there some neater way to accomplish this?</strong></p>
  <p><strong>Is there a constant which specifies the platform separator or a function that allows me to construct these lists?</strong></p>
  <hr />
  <p>If there is no &quot;proper&quot; answer, I also wanted to share my obvious, but not-so-nice solution:</p>
  <pre><code>if(&quot;${CMAKE_HOST_SYSTEM}&quot; MATCHES &quot;.*Windows.*&quot;)
    set(SEP &quot;\\;&quot;)
  else() # e.g. Linux
    set(SEP &quot;:&quot;)
  endif()
  
  add_test(my_awesome_test ${PYTHON_EXECUTABLE} my_awesome_test.py)
  set_tests_properties(my_awesome_test PROPERTIES ENVIRONMENT &quot;PYTHONPATH=somepath${SEP}anotherpath&quot;)
  
  # more tests like this after this...
  </code></pre>
  <p>On Windows the &quot;;&quot; must be double escaped because otherwise it it is substituted later in the add_test line as a single &quot;;&quot; again, which is then in turn interpreted as the cmake-list separator leading to wrong results. However, having cmake report which character should be used as list separator would still be nicer...</p>