diff options
author | Marc Chevrier <marc.chevrier@sap.com> | 2018-04-05 10:09:53 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@sap.com> | 2018-04-05 10:09:53 (GMT) |
commit | 38dcdd76413c012a569eccb67c195f1d6840e2b8 (patch) | |
tree | 71a140462721242f9ff83ea0cd62777e3c101a99 /Tests/UseSWIG | |
parent | 3201e4c156fcf79a7c29a73430e72b1bcd43cedc (diff) | |
download | CMake-38dcdd76413c012a569eccb67c195f1d6840e2b8.zip CMake-38dcdd76413c012a569eccb67c195f1d6840e2b8.tar.gz CMake-38dcdd76413c012a569eccb67c195f1d6840e2b8.tar.bz2 |
UseSWIG: Ensure tests are usable in multi-config mode.
Fixes: #17875
Diffstat (limited to 'Tests/UseSWIG')
-rw-r--r-- | Tests/UseSWIG/BasicConfiguration.cmake | 7 | ||||
-rw-r--r-- | Tests/UseSWIG/BasicPerl/CMakeLists.txt | 12 | ||||
-rw-r--r-- | Tests/UseSWIG/BasicPython/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/UseSWIG/LegacyConfiguration.cmake | 7 | ||||
-rw-r--r-- | Tests/UseSWIG/LegacyPerl/CMakeLists.txt | 12 | ||||
-rw-r--r-- | Tests/UseSWIG/LegacyPython/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/UseSWIG/ModuleVersion2/CMakeLists.txt | 12 | ||||
-rw-r--r-- | Tests/UseSWIG/MultipleModules/CMakeLists.txt | 21 | ||||
-rw-r--r-- | Tests/UseSWIG/MultiplePython/CMakeLists.txt | 11 |
9 files changed, 45 insertions, 41 deletions
diff --git a/Tests/UseSWIG/BasicConfiguration.cmake b/Tests/UseSWIG/BasicConfiguration.cmake index 73298567..d025d2a 100644 --- a/Tests/UseSWIG/BasicConfiguration.cmake +++ b/Tests/UseSWIG/BasicConfiguration.cmake @@ -2,6 +2,13 @@ find_package(SWIG REQUIRED) include(${SWIG_USE_FILE}) +# Path separator +if (WIN32) + set (PS "$<SEMICOLON>") +else() + set (PS ":") +endif() + unset(SWIG_LANG_TYPE) unset(SWIG_LANG_INCLUDE_DIRECTORIES) unset(SWIG_LANG_DEFINITIONS) diff --git a/Tests/UseSWIG/BasicPerl/CMakeLists.txt b/Tests/UseSWIG/BasicPerl/CMakeLists.txt index 10c1cd8..476ef0e 100644 --- a/Tests/UseSWIG/BasicPerl/CMakeLists.txt +++ b/Tests/UseSWIG/BasicPerl/CMakeLists.txt @@ -8,15 +8,7 @@ set(language "perl") include (../BasicConfiguration.cmake) -if (WIN32) - file (TO_CMAKE_PATH "$ENV{PATH}" perl_path) - string (REPLACE ";" "$<SEMICOLON>" perl_path "${perl_path}") - set (perl_env "PATH=$<TARGET_FILE_DIR:example>$<SEMICOLON>${perl_path}") -else() - set (perl_env "LD_LIBRARY_PATH=$<TARGET_FILE_DIR:example>") -endif() - add_test (NAME BasicPerl - COMMAND "${CMAKE_COMMAND}" -E env "${perl_env}" - "${PERL_EXECUTABLE}" "-I$<TARGET_FILE_DIR:example>" + COMMAND "${PERL_EXECUTABLE}" "-I${CMAKE_CURRENT_BINARY_DIR}" + "-I$<TARGET_FILE_DIR:example>" "${CMAKE_CURRENT_SOURCE_DIR}/../runme.pl") diff --git a/Tests/UseSWIG/BasicPython/CMakeLists.txt b/Tests/UseSWIG/BasicPython/CMakeLists.txt index 1ca4e25..cf1d821 100644 --- a/Tests/UseSWIG/BasicPython/CMakeLists.txt +++ b/Tests/UseSWIG/BasicPython/CMakeLists.txt @@ -9,5 +9,5 @@ set(language "python") include (../BasicConfiguration.cmake) add_test (NAME BasicPython - COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:example>" + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}${PS}$<TARGET_FILE_DIR:example>" "${Python_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../runme.py") diff --git a/Tests/UseSWIG/LegacyConfiguration.cmake b/Tests/UseSWIG/LegacyConfiguration.cmake index 640c713..1acc05a 100644 --- a/Tests/UseSWIG/LegacyConfiguration.cmake +++ b/Tests/UseSWIG/LegacyConfiguration.cmake @@ -5,6 +5,13 @@ set (CMAKE_WARN_DEPRECATED FALSE) find_package(SWIG REQUIRED) include(${SWIG_USE_FILE}) +# Path separator +if (WIN32) + set (PS "$<SEMICOLON>") +else() + set (PS ":") +endif() + unset(SWIG_LANG_TYPE) if(${language} MATCHES python) find_package(PythonInterp REQUIRED) diff --git a/Tests/UseSWIG/LegacyPerl/CMakeLists.txt b/Tests/UseSWIG/LegacyPerl/CMakeLists.txt index 0def5f5..90d92f4 100644 --- a/Tests/UseSWIG/LegacyPerl/CMakeLists.txt +++ b/Tests/UseSWIG/LegacyPerl/CMakeLists.txt @@ -8,15 +8,7 @@ set(language "perl") include (../LegacyConfiguration.cmake) -if (WIN32) - file (TO_CMAKE_PATH "$ENV{PATH}" perl_path) - string (REPLACE ";" "$<SEMICOLON>" perl_path "${perl_path}") - set (perl_env "PATH=$<TARGET_FILE_DIR:${SWIG_MODULE_example_REAL_NAME}>$<SEMICOLON>${perl_path}") -else() - set (perl_env "LD_LIBRARY_PATH=$<TARGET_FILE_DIR:${SWIG_MODULE_example_REAL_NAME}>") -endif() - add_test (NAME LegacyPerl - COMMAND "${CMAKE_COMMAND}" -E env "${perl_env}" - "${PERL_EXECUTABLE}" "-I$<TARGET_FILE_DIR:${SWIG_MODULE_example_REAL_NAME}>" + COMMAND "${PERL_EXECUTABLE}" "-I${CMAKE_CURRENT_BINARY_DIR}" + "-I$<TARGET_FILE_DIR:${SWIG_MODULE_example_REAL_NAME}>" "${CMAKE_CURRENT_SOURCE_DIR}/../runme.pl") diff --git a/Tests/UseSWIG/LegacyPython/CMakeLists.txt b/Tests/UseSWIG/LegacyPython/CMakeLists.txt index 11a0d28..03facb1 100644 --- a/Tests/UseSWIG/LegacyPython/CMakeLists.txt +++ b/Tests/UseSWIG/LegacyPython/CMakeLists.txt @@ -9,5 +9,5 @@ set(language "python") include (../LegacyConfiguration.cmake) add_test (NAME LegacyPython - COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:${SWIG_MODULE_example_REAL_NAME}>" + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}${PS}$<TARGET_FILE_DIR:${SWIG_MODULE_example_REAL_NAME}>" "${PYTHON_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../runme.py") diff --git a/Tests/UseSWIG/ModuleVersion2/CMakeLists.txt b/Tests/UseSWIG/ModuleVersion2/CMakeLists.txt index 92cbcd3..3f9d363 100644 --- a/Tests/UseSWIG/ModuleVersion2/CMakeLists.txt +++ b/Tests/UseSWIG/ModuleVersion2/CMakeLists.txt @@ -10,6 +10,12 @@ include(${SWIG_USE_FILE}) find_package(Python2 REQUIRED COMPONENTS Interpreter Development) find_package(Python3 REQUIRED COMPONENTS Interpreter Development) +if (WIN32) + set (PS $<SEMICOLON>) +else() + set (PS ":") +endif() + set (UseSWIG_MODULE_VERSION 2) unset(CMAKE_SWIG_FLAGS) @@ -41,12 +47,6 @@ set_target_properties (example2 PROPERTIES target_link_libraries(example2 PRIVATE Python3::Python) -if (WIN32) - set (PS $<SEMICOLON>) -else() - set (PS ":") -endif() - add_test (NAME ModuleVersion2.example1 COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_PROPERTY:example1,SWIG_SUPPORT_FILES_DIRECTORY>${PS}$<TARGET_FILE_DIR:example1>" "${Python2_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../runme.py") diff --git a/Tests/UseSWIG/MultipleModules/CMakeLists.txt b/Tests/UseSWIG/MultipleModules/CMakeLists.txt index d495007..578825f 100644 --- a/Tests/UseSWIG/MultipleModules/CMakeLists.txt +++ b/Tests/UseSWIG/MultipleModules/CMakeLists.txt @@ -12,6 +12,13 @@ find_package(Python REQUIRED COMPONENTS Interpreter Development) find_package(Perl REQUIRED) find_package(PerlLibs REQUIRED) +# Path separator +if (WIN32) + set (PS "$<SEMICOLON>") +else() + set (PS ":") +endif() + unset(CMAKE_SWIG_FLAGS) set_property(SOURCE "../example.i" PROPERTY CPLUSPLUS ON) @@ -51,19 +58,11 @@ target_link_libraries(example2 PRIVATE ${PERL_LIBRARY}) add_test (NAME MultipleModules.Python - COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:example1>" + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}/Python${PS}$<TARGET_FILE_DIR:example1>" "${Python_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../runme.py") -if (WIN32) - file (TO_CMAKE_PATH "$ENV{PATH}" perl_path) - string (REPLACE ";" "$<SEMICOLON>" perl_path "${perl_path}") - set (perl_env "PATH=$<TARGET_FILE_DIR:example2>$<SEMICOLON>${perl_path}") -else() - set (perl_env "LD_LIBRARY_PATH=$<TARGET_FILE_DIR:example2>") -endif() - add_test (NAME MultipleModules.Perl - COMMAND "${CMAKE_COMMAND}" -E env "${perl_env}" - "${PERL_EXECUTABLE}" "-I$<TARGET_FILE_DIR:example2>" + COMMAND "${PERL_EXECUTABLE}" "-I${CMAKE_CURRENT_BINARY_DIR}/Perl" + "-I$<TARGET_FILE_DIR:example2>" "${CMAKE_CURRENT_SOURCE_DIR}/../runme.pl") diff --git a/Tests/UseSWIG/MultiplePython/CMakeLists.txt b/Tests/UseSWIG/MultiplePython/CMakeLists.txt index 260a382..a5e3eed 100644 --- a/Tests/UseSWIG/MultiplePython/CMakeLists.txt +++ b/Tests/UseSWIG/MultiplePython/CMakeLists.txt @@ -10,6 +10,13 @@ include(${SWIG_USE_FILE}) find_package(Python2 REQUIRED COMPONENTS Interpreter Development) find_package(Python3 REQUIRED COMPONENTS Interpreter Development) +# Path separator +if (WIN32) + set (PS "$<SEMICOLON>") +else() + set (PS ":") +endif() + unset(CMAKE_SWIG_FLAGS) set_property(SOURCE "../example.i" PROPERTY CPLUSPLUS ON) @@ -44,9 +51,9 @@ target_link_libraries(example2 PRIVATE Python3::Python) add_test (NAME MultiplePython.example1 - COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:example1>" + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}/Python2${PS}$<TARGET_FILE_DIR:example1>" "${Python2_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../runme.py") add_test (NAME MultiplePython.example2 - COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:example2>" + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}/Python3${PS}$<TARGET_FILE_DIR:example2>" "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../runme.py") |