diff options
30 files changed, 612 insertions, 139 deletions
diff --git a/Help/release/3.17.rst b/Help/release/3.17.rst index 7c5b44d..91e2463 100644 --- a/Help/release/3.17.rst +++ b/Help/release/3.17.rst @@ -333,3 +333,12 @@ Changes made since CMake 3.17.0 include the following. * CMake 3.17.0 updated the :cpack_gen:`CPack NSIS Generator` with changes that require NSIS 3.0 or later. CMake 3.17.1 now enforces the use of a sufficiently new version. + +3.17.3 +------ + +* The :module:`FindPkgConfig` module now extracts include directories + prefixed with ``-isystem`` into the ``*_INCLUDE_DIRS`` variables and + :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` target properties. + Previously they would be places in ``*_CFLAGS_OTHER`` variables and + :prop_tgt:`INTERFACE_COMPILE_OPTIONS` target properties. diff --git a/Help/release/dev/FindPython-pypy.rst b/Help/release/dev/FindPython-pypy.rst new file mode 100644 index 0000000..84f0db1 --- /dev/null +++ b/Help/release/dev/FindPython-pypy.rst @@ -0,0 +1,5 @@ +FindPython-pypy +--------------- + +* The :module:`FindPython3`, :module:`FindPython2` and :module:`FindPython` + modules gained the capability to handle ``PyPy`` product. diff --git a/Modules/CheckLanguage.cmake b/Modules/CheckLanguage.cmake index f48107a..d67d8d3 100644 --- a/Modules/CheckLanguage.cmake +++ b/Modules/CheckLanguage.cmake @@ -43,7 +43,7 @@ macro(check_language lang) file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang}) set(extra_compiler_variables) - if(lang STREQUAL CUDA) + if(${lang} STREQUAL CUDA) set(extra_compiler_variables "set(CMAKE_CUDA_HOST_COMPILER \\\"\${CMAKE_CUDA_HOST_COMPILER}\\\")") endif() diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 57e17b3..13981d3 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -754,7 +754,11 @@ function(_Boost_GUESS_COMPILER_PREFIX _ret) set(_boost_COMPILER "-mgw") # no GCC version encoding prior to 1.34 else() _Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION _boost_COMPILER_VERSION_MAJOR _boost_COMPILER_VERSION_MINOR) - set(_boost_COMPILER "-mgw${_boost_COMPILER_VERSION}") + if(Boost_VERSION_STRING VERSION_GREATER_EQUAL 1.73 AND _boost_COMPILER_VERSION_MAJOR VERSION_GREATER_EQUAL 5) + set(_boost_COMPILER "-mgw${_boost_COMPILER_VERSION_MAJOR}") + else() + set(_boost_COMPILER "-mgw${_boost_COMPILER_VERSION}") + endif() endif() elseif (UNIX) _Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION _boost_COMPILER_VERSION_MAJOR _boost_COMPILER_VERSION_MINOR) @@ -1453,7 +1457,7 @@ else() # _Boost_COMPONENT_HEADERS. See the instructions at the top of # _Boost_COMPONENT_DEPENDENCIES. set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS} - "1.72.0" "1.72" "1.71.0" "1.71" "1.70.0" "1.70" "1.69.0" "1.69" + "1.73.0" "1.73" "1.72.0" "1.72" "1.71.0" "1.71" "1.70.0" "1.70" "1.69.0" "1.69" "1.68.0" "1.68" "1.67.0" "1.67" "1.66.0" "1.66" "1.65.1" "1.65.0" "1.65" "1.64.0" "1.64" "1.63.0" "1.63" "1.62.0" "1.62" "1.61.0" "1.61" "1.60.0" "1.60" "1.59.0" "1.59" "1.58.0" "1.58" "1.57.0" "1.57" "1.56.0" "1.56" "1.55.0" "1.55" diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index 835811c..93827d8 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -412,6 +412,36 @@ function(_pkgconfig_extract_frameworks _prefix) set(${_prefix}_LDFLAGS_OTHER "${ldflags}" PARENT_SCOPE) endfunction() +# pkg-config returns -isystem include directories in --cflags-only-other, +# depending on the version and if there is a space between -isystem and +# the actual path +function(_pkgconfig_extract_isystem _prefix) + set(cflags "${${_prefix}_CFLAGS_OTHER}") + set(outflags "") + set(incdirs "${${_prefix}_INCLUDE_DIRS}") + + set(next_is_isystem FALSE) + foreach (THING IN LISTS cflags) + # This may filter "-isystem -isystem". That would not work anyway, + # so let it happen. + if (THING STREQUAL "-isystem") + set(next_is_isystem TRUE) + continue() + endif () + if (next_is_isystem) + set(next_is_isystem FALSE) + list(APPEND incdirs "${THING}") + elseif (THING MATCHES "^-isystem") + string(SUBSTRING "${THING}" 8 -1 THING) + list(APPEND incdirs "${THING}") + else () + list(APPEND outflags "${THING}") + endif () + endforeach () + set(${_prefix}_CFLAGS_OTHER "${outflags}" PARENT_SCOPE) + set(${_prefix}_INCLUDE_DIRS "${incdirs}" PARENT_SCOPE) +endfunction() + ### macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cmake_environment_path _imp_target _imp_target_global _prefix) _pkgconfig_unset(${_prefix}_FOUND) @@ -545,18 +575,22 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma endforeach() # set variables which are combined for multiple modules - _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LIBRARIES "(^| )-l" --libs-only-l ) - _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LIBRARY_DIRS "(^| )-L" --libs-only-L ) - _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LDFLAGS "" --libs ) - _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LDFLAGS_OTHER "" --libs-only-other ) + _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LIBRARIES "(^| )-l" --libs-only-l ) + _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LIBRARY_DIRS "(^| )-L" --libs-only-L ) + _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LDFLAGS "" --libs ) + _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LDFLAGS_OTHER "" --libs-only-other ) if (APPLE AND "-framework" IN_LIST ${_prefix}_LDFLAGS_OTHER) _pkgconfig_extract_frameworks("${_prefix}") endif() - _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" INCLUDE_DIRS "(^| )-I" --cflags-only-I ) - _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS "" --cflags ) - _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS_OTHER "" --cflags-only-other ) + _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" INCLUDE_DIRS "(^| )(-I|-isystem ?)" --cflags-only-I ) + _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS "" --cflags ) + _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS_OTHER "" --cflags-only-other ) + + if (${_prefix}_CFLAGS_OTHER MATCHES "-isystem") + _pkgconfig_extract_isystem("${_prefix}") + endif () _pkg_recalculate("${_prefix}" ${_no_cmake_path} ${_no_cmake_environment_path} ${_imp_target} ${_imp_target_global}) endif() diff --git a/Modules/FindPython.cmake b/Modules/FindPython.cmake index 93f77a8..a97f3c5 100644 --- a/Modules/FindPython.cmake +++ b/Modules/FindPython.cmake @@ -85,6 +85,7 @@ This module will set the following variables in your project * Anaconda * Canopy * IronPython + * PyPy ``Python_STDLIB`` Standard platform independent installation directory. @@ -147,6 +148,8 @@ This module will set the following variables in your project Python minor version. ``Python_VERSION_PATCH`` Python patch version. +``Python_PyPy_VERSION`` + Python PyPy version. ``Python_NumPy_FOUND`` System has the NumPy. ``Python_NumPy_INCLUDE_DIRS`` @@ -281,6 +284,9 @@ Hints * ``IronPython``: This implementation use the ``CSharp`` language for ``.NET Framework`` on top of the `Dynamic Language Runtime` (``DLR``). See `IronPython <http://ironpython.net>`_. + * ``PyPy``: This implementation use ``RPython`` language and + ``RPython translation toolchain`` to produce the python interpreter. + See `PyPy <https://www.pypy.org>`_. The default value is the list: ``CPython``, ``IronPython``. diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake index 733faa8..6aeb74a 100644 --- a/Modules/FindPython/Support.cmake +++ b/Modules/FindPython/Support.cmake @@ -263,6 +263,14 @@ function (_PYTHON_GET_PATH_SUFFIXES _PYTHON_PGPS_PATH_SUFFIXES) if (_PGPS_EXECUTABLE) list (APPEND path_suffixes ${_${_PYTHON_PREFIX}_IRON_PYTHON_PATH_SUFFIXES}) endif() + elseif (implementation STREQUAL "PyPy") + if (_PGPS_EXECUTABLE) + list (APPEND path_suffixes ${_${_PYTHON_PREFIX}_PYPY_EXECUTABLE_PATH_SUFFIXES}) + elseif (_PGPS_LIBRARY) + list (APPEND path_suffixes ${_${_PYTHON_PREFIX}_PYPY_LIBRARY_PATH_SUFFIXES}) + elseif (_PGPS_INCLUDE) + list (APPEND path_suffixes ${_${_PYTHON_PREFIX}_PYPY_INCLUDE_PATH_SUFFIXES}) + endif() endif() endforeach() list (REMOVE_DUPLICATES path_suffixes) @@ -333,6 +341,23 @@ function (_PYTHON_GET_NAMES _PYTHON_PGN_NAMES) if (_PGN_EXECUTABLE) list (APPEND names ${_${_PYTHON_PREFIX}_IRON_PYTHON_NAMES}) endif() + elseif (implementation STREQUAL "PyPy") + if (_PGN_EXECUTABLE) + list (APPEND names ${_${_PYTHON_PREFIX}_PYPY_NAMES}) + elseif (_PGN_LIBRARY) + if (_PGN_WIN32) + foreach (version IN LISTS _PGN_VERSION) + string (REPLACE "." "" version_no_dots ${version}) + + set (name "python${version_no_dots}") + if (_PGN_DEBUG) + string (APPEND name "_d") + endif() + list (APPEND names "${name}") + endforeach() + endif() + list (APPEND names ${_${_PYTHON_PREFIX}_PYPY_LIB_NAMES}) + endif() endif() endforeach() @@ -484,8 +509,18 @@ function (_PYTHON_GET_VERSION) set (${_PGV_PREFIX}VERSION_MINOR "${CMAKE_MATCH_2}" PARENT_SCOPE) set (${_PGV_PREFIX}VERSION "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}" PARENT_SCOPE) set (${_PGV_PREFIX}ABI "${CMAKE_MATCH_3}" PARENT_SCOPE) + elseif (_${_PYTHON_PREFIX}_LIBRARY_RELEASE MATCHES "pypy(3)?") + set (version "${CMAKE_MATCH_1}") + if (version EQUAL "3") + set (${_PGV_PREFIX}VERSION_MAJOR "3" PARENT_SCOPE) + set (${_PGV_PREFIX}VERSION "3" PARENT_SCOPE) + else() + set (${_PGV_PREFIX}VERSION_MAJOR "2" PARENT_SCOPE) + set (${_PGV_PREFIX}VERSION "2" PARENT_SCOPE) endif() + set (${_PGV_PREFIX}ABI "" PARENT_SCOPE) endif() + endif() else() if (_${_PYTHON_PREFIX}_INCLUDE_DIR) # retrieve version from header file @@ -977,12 +1012,34 @@ else() endif() set (_${_PYTHON_PREFIX}_IRON_PYTHON_PATH_SUFFIXES net45 net40) +# PyPy support +if (_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR EQUAL "3") + set (_${_PYTHON_PREFIX}_PYPY_NAMES pypy3) + set (_${_PYTHON_PREFIX}_PYPY_LIB_NAMES pypy3-c) + if (WIN32) + # special name for runtime part + list (APPEND _${_PYTHON_PREFIX}_PYPY_LIB_NAMES libpypy3-c) + endif() + set (_${_PYTHON_PREFIX}_PYPY_INCLUDE_PATH_SUFFIXES lib/pypy3) +else() + set (_${_PYTHON_PREFIX}_PYPY_NAMES pypy) + set (_${_PYTHON_PREFIX}_PYPY_LIB_NAMES pypy-c) + if (WIN32) + # special name for runtime part + list (APPEND _${_PYTHON_PREFIX}_PYPY_LIB_NAMES libpypy-c) + endif() + set (_${_PYTHON_PREFIX}_PYPY_INCLUDE_PATH_SUFFIXES lib/pypy) +endif() +set (_${_PYTHON_PREFIX}_PYPY_EXECUTABLE_PATH_SUFFIXES bin) +set (_${_PYTHON_PREFIX}_PYPY_LIBRARY_PATH_SUFFIXES lib libs bin) +list (APPEND _${_PYTHON_PREFIX}_PYPY_INCLUDE_PATH_SUFFIXES include) + # Python Implementations handling unset (_${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS) if (DEFINED ${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS) foreach (_${_PYTHON_PREFIX}_IMPLEMENTATION IN LISTS ${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS) - if (NOT _${_PYTHON_PREFIX}_IMPLEMENTATION MATCHES "^(CPython|IronPython)$") - message (AUTHOR_WARNING "Find${_PYTHON_PREFIX}: ${_${_PYTHON_PREFIX}_IMPLEMENTATION}: invalid value for '${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS'. 'CPython' or 'IronPython' expected. Value will be ignored.") + if (NOT _${_PYTHON_PREFIX}_IMPLEMENTATION MATCHES "^(CPython|IronPython|PyPy)$") + message (AUTHOR_WARNING "Find${_PYTHON_PREFIX}: ${_${_PYTHON_PREFIX}_IMPLEMENTATION}: invalid value for '${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS'. 'CPython', 'IronPython' or 'PyPy' expected. Value will be ignored.") else() list (APPEND _${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS ${_${_PYTHON_PREFIX}_IMPLEMENTATION}) endif() @@ -996,6 +1053,8 @@ unset (_${_PYTHON_PREFIX}_INCLUDE_NAMES) foreach (_${_PYTHON_PREFIX}_IMPLEMENTATION IN LISTS _${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS) if (_${_PYTHON_PREFIX}_IMPLEMENTATION STREQUAL "CPython") list (APPEND _${_PYTHON_PREFIX}_INCLUDE_NAMES "Python.h") + elseif (_${_PYTHON_PREFIX}_IMPLEMENTATION STREQUAL "PyPy") + list (APPEND _${_PYTHON_PREFIX}_INCLUDE_NAMES "PyPy.h") endif() endforeach() @@ -1150,7 +1209,7 @@ unset (_${_PYTHON_PREFIX}_NumPy_REASON_FAILURE) # first step, search for the interpreter if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) list (APPEND _${_PYTHON_PREFIX}_CACHED_VARS _${_PYTHON_PREFIX}_EXECUTABLE - _${_PYTHON_PREFIX}_INTERPRETER_PROPERTIES) + _${_PYTHON_PREFIX}_INTERPRETER_PROPERTIES) if (${_PYTHON_PREFIX}_FIND_REQUIRED_Interpreter) list (APPEND _${_PYTHON_PREFIX}_REQUIRED_VARS ${_PYTHON_PREFIX}_EXECUTABLE) endif() @@ -1526,6 +1585,9 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) set (${_PYTHON_PREFIX}_INTERPRETER_ID "Anaconda") elseif (${_PYTHON_PREFIX}_INTERPRETER_ID MATCHES "Enthought") set (${_PYTHON_PREFIX}_INTERPRETER_ID "Canopy") + elseif (${_PYTHON_PREFIX}_INTERPRETER_ID MATCHES "PyPy ([0-9.]+)") + set (${_PYTHON_PREFIX}_INTERPRETER_ID "PyPy") + set (${_PYTHON_PREFIX}_PyPy_VERSION "${CMAKE_MATCH_1}") else() string (REGEX REPLACE "^([^ ]+).*" "\\1" ${_PYTHON_PREFIX}_INTERPRETER_ID "${${_PYTHON_PREFIX}_INTERPRETER_ID}") if (${_PYTHON_PREFIX}_INTERPRETER_ID STREQUAL "Python") @@ -1811,11 +1873,19 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS AND ((${_PYTHON_PREFIX}_Interpreter_FOUND AND NOT ${_PYTHON_PREFIX}_INTERPRETER_ID STREQUAL "IronPython") OR NOT ${_PYTHON_PREFIX}_Interpreter_FOUND)) + if (${_PYTHON_PREFIX}_Interpreter_FOUND) + # reduce possible implementations to the interpreter one + if (${_PYTHON_PREFIX}_INTERPRETER_ID STREQUAL "PyPy") + set (_${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS "PyPy") + else() + set (_${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS "CPython") + endif() + endif() if ("LIBRARY" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_ARTIFACTS) - list (APPEND _${_PYTHON_PREFIX}_CACHED_VARS _${_PYTHON_PREFIX}_LIBRARY_RELEASE - _${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE - _${_PYTHON_PREFIX}_LIBRARY_DEBUG - _${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG) + list (APPEND _${_PYTHON_PREFIX}_CACHED_VARS _${_PYTHON_PREFIX}_LIBRARY_RELEASE + _${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE + _${_PYTHON_PREFIX}_LIBRARY_DEBUG + _${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG) endif() if ("INCLUDE_DIR" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_ARTIFACTS) list (APPEND _${_PYTHON_PREFIX}_CACHED_VARS _${_PYTHON_PREFIX}_INCLUDE_DIR) @@ -2265,7 +2335,8 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS _python_find_runtime_library (_${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE NAMES ${_${_PYTHON_PREFIX}_LIB_NAMES} NAMES_PER_DIR - HINTS "${_${_PYTHON_PREFIX}_PATH}" "${_${_PYTHON_PREFIX}_PATH2}" ${_${_PYTHON_PREFIX}_HINTS} + HINTS "${_${_PYTHON_PREFIX}_PATH}" + "${_${_PYTHON_PREFIX}_PATH2}" ${_${_PYTHON_PREFIX}_HINTS} PATH_SUFFIXES bin) endif() if (_${_PYTHON_PREFIX}_LIBRARY_DEBUG) @@ -2275,7 +2346,8 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS _python_find_runtime_library (_${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG NAMES ${_${_PYTHON_PREFIX}_LIB_NAMES_DEBUG} NAMES_PER_DIR - HINTS "${_${_PYTHON_PREFIX}_PATH}" "${_${_PYTHON_PREFIX}_PATH2}" ${_${_PYTHON_PREFIX}_HINTS} + HINTS "${_${_PYTHON_PREFIX}_PATH}" + "${_${_PYTHON_PREFIX}_PATH2}" ${_${_PYTHON_PREFIX}_HINTS} PATH_SUFFIXES bin) endif() endif() @@ -2482,6 +2554,16 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS set (${_PYTHON_PREFIX}_Development_FOUND TRUE) endif() + if ((${_PYTHON_PREFIX}_Development.Module_FOUND + OR ${_PYTHON_PREFIX}_Development.Embed_FOUND) + AND EXISTS "${_${_PYTHON_PREFIX}_INCLUDE_DIR}/PyPy.h") + # retrieve PyPy version + file (STRINGS "${_${_PYTHON_PREFIX}_INCLUDE_DIR}/patchlevel.h" ${_PYTHON_PREFIX}_PyPy_VERSION + REGEX "^#define[ \t]+PYPY_VERSION[ \t]+\"[^\"]+\"") + string (REGEX REPLACE "^#define[ \t]+PYPY_VERSION[ \t]+\"([^\"]+)\".*" "\\1" + ${_PYTHON_PREFIX}_PyPy_VERSION "${${_PYTHON_PREFIX}_PyPy_VERSION}") + endif() + if (_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR VERSION_GREATER_EQUAL "3" AND NOT DEFINED ${_PYTHON_PREFIX}_SOABI) _python_get_config_var (${_PYTHON_PREFIX}_SOABI SOABI) diff --git a/Modules/FindPython2.cmake b/Modules/FindPython2.cmake index def6f3c..4ef0e5a 100644 --- a/Modules/FindPython2.cmake +++ b/Modules/FindPython2.cmake @@ -86,6 +86,7 @@ This module will set the following variables in your project * Anaconda * Canopy * IronPython + * PyPy ``Python2_STDLIB`` Standard platform independent installation directory. @@ -139,6 +140,8 @@ This module will set the following variables in your project Python 2 minor version. ``Python2_VERSION_PATCH`` Python 2 patch version. +``Python2_PyPy_VERSION`` + Python 2 PyPy version. ``Python2_NumPy_FOUND`` System has the NumPy. ``Python2_NumPy_INCLUDE_DIRS`` @@ -228,6 +231,9 @@ Hints * ``IronPython``: This implementation use the ``CSharp`` language for ``.NET Framework`` on top of the `Dynamic Language Runtime` (``DLR``). See `IronPython <http://ironpython.net>`_. + * ``PyPy``: This implementation use ``RPython`` language and + ``RPython translation toolchain`` to produce the python interpreter. + See `PyPy <https://www.pypy.org>`_. The default value is the list: ``CPython``, ``IronPython``. diff --git a/Modules/FindPython3.cmake b/Modules/FindPython3.cmake index 3660ee8..d8fc54a 100644 --- a/Modules/FindPython3.cmake +++ b/Modules/FindPython3.cmake @@ -86,6 +86,7 @@ This module will set the following variables in your project * Anaconda * Canopy * IronPython + * PyPy ``Python3_STDLIB`` Standard platform independent installation directory. @@ -148,6 +149,8 @@ This module will set the following variables in your project Python 3 minor version. ``Python3_VERSION_PATCH`` Python 3 patch version. +``Python3_PyPy_VERSION`` + Python 3 PyPy version. ``Python3_NumPy_FOUND`` System has the NumPy. ``Python3_NumPy_INCLUDE_DIRS`` @@ -278,6 +281,9 @@ Hints * ``IronPython``: This implementation use the ``CSharp`` language for ``.NET Framework`` on top of the `Dynamic Language Runtime` (``DLR``). See `IronPython <http://ironpython.net>`_. + * ``PyPy``: This implementation use ``RPython`` language and + ``RPython translation toolchain`` to produce the python interpreter. + See `PyPy <https://www.pypy.org>`_. The default value is the list: ``CPython``, ``IronPython``. diff --git a/Modules/GoogleTestAddTests.cmake b/Modules/GoogleTestAddTests.cmake index 499332f..4af62ed 100644 --- a/Modules/GoogleTestAddTests.cmake +++ b/Modules/GoogleTestAddTests.cmake @@ -83,6 +83,8 @@ function(gtest_discover_tests_impl) ) endif() + # Preserve semicolon in test-parameters + string(REPLACE [[;]] [[\;]] output "${output}") string(REPLACE "\n" ";" output "${output}") # Parse output @@ -114,9 +116,19 @@ function(gtest_discover_tests_impl) else() unset(TEST_XML_OUTPUT_PARAM) endif() + + # sanitize test name for further processing downstream + set(testname "${prefix}${pretty_suite}.${pretty_test}${suffix}") + # escape \ + string(REPLACE [[\]] [[\\]] testname "${testname}") + # escape ; + string(REPLACE [[;]] [[\;]] testname "${testname}") + # escape $ + string(REPLACE [[$]] [[\$]] testname "${testname}") + # ...and add to script add_command(add_test - "${prefix}${pretty_suite}.${pretty_test}${suffix}" + "${testname}" ${_TEST_EXECUTOR} "${_TEST_EXECUTABLE}" "--gtest_filter=${suite}.${test}" @@ -126,18 +138,18 @@ function(gtest_discover_tests_impl) ) if(suite MATCHES "^DISABLED" OR test MATCHES "^DISABLED") add_command(set_tests_properties - "${prefix}${pretty_suite}.${pretty_test}${suffix}" + "${testname}" PROPERTIES DISABLED TRUE ) endif() add_command(set_tests_properties - "${prefix}${pretty_suite}.${pretty_test}${suffix}" + "${testname}" PROPERTIES WORKING_DIRECTORY "${_TEST_WORKING_DIR}" SKIP_REGULAR_EXPRESSION "\\\\[ SKIPPED \\\\]" ${properties} ) - list(APPEND tests_buffer "${prefix}${pretty_suite}.${pretty_test}${suffix}") + list(APPEND tests_buffer "${testname}") list(LENGTH tests_buffer tests_buffer_length) if(${tests_buffer_length} GREATER "250") flush_tests_buffer() diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 76e8ca5..e980fc7 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 17) -set(CMake_VERSION_PATCH 20200503) +set(CMake_VERSION_PATCH 20200507) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/bindexplib.cxx b/Source/bindexplib.cxx index 4a5c641..8435740 100644 --- a/Source/bindexplib.cxx +++ b/Source/bindexplib.cxx @@ -276,8 +276,9 @@ public: symbol.compare(0, 4, vectorPrefix)) { SectChar = this->SectionHeaders[pSymbolTable->SectionNumber - 1] .Characteristics; - // skip symbols containing a dot - if (symbol.find('.') == std::string::npos) { + // skip symbols containing a dot or are from managed code + if (symbol.find('.') == std::string::npos && + !SymbolIsFromManagedCode(symbol)) { if (!pSymbolTable->Type && (SectChar & IMAGE_SCN_MEM_WRITE)) { // Read only (i.e. constants) must be excluded this->DataSymbols.insert(symbol); @@ -302,6 +303,13 @@ public: } private: + bool SymbolIsFromManagedCode(std::string const& symbol) + { + return symbol == "__t2m" || symbol == "__m2mep" || symbol == "__mep" || + symbol.find("$$F") != std::string::npos || + symbol.find("$$J") != std::string::npos; + } + std::set<std::string>& Symbols; std::set<std::string>& DataSymbols; DWORD_PTR SymbolCount; diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx b/Source/cmGlobalWatcomWMakeGenerator.cxx index 07e0793..d6a7afa 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.cxx +++ b/Source/cmGlobalWatcomWMakeGenerator.cxx @@ -44,6 +44,16 @@ void cmGlobalWatcomWMakeGenerator::EnableLanguage( this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional); } +bool cmGlobalWatcomWMakeGenerator::SetSystemName(std::string const& s, + cmMakefile* mf) +{ + if (mf->GetSafeDefinition("CMAKE_SYSTEM_PROCESSOR") == "I86") { + mf->AddDefinition("CMAKE_GENERATOR_CC", "wcl"); + mf->AddDefinition("CMAKE_GENERATOR_CXX", "wcl"); + } + return this->cmGlobalUnixMakefileGenerator3::SetSystemName(s, mf); +} + void cmGlobalWatcomWMakeGenerator::GetDocumentation( cmDocumentationEntry& entry) { diff --git a/Source/cmGlobalWatcomWMakeGenerator.h b/Source/cmGlobalWatcomWMakeGenerator.h index c0daf8a..c47127f 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.h +++ b/Source/cmGlobalWatcomWMakeGenerator.h @@ -41,6 +41,9 @@ public: /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); + /** Tell the generator about the target system. */ + bool SetSystemName(std::string const& s, cmMakefile* mf) override; + /** * Try to determine system information such as shared library * extension, pthreads, byte order etc. diff --git a/Source/cmake.cxx b/Source/cmake.cxx index d6abd18..b451d27 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -138,6 +138,7 @@ using JsonValueMapType = std::unordered_map<std::string, Json::Value>; static bool cmakeCheckStampFile(const std::string& stampName); static bool cmakeCheckStampList(const std::string& stampList); +#ifndef CMAKE_BOOTSTRAP static void cmWarnUnusedCliWarning(const std::string& variable, int /*unused*/, void* ctx, const char* /*unused*/, const cmMakefile* /*unused*/) @@ -145,6 +146,7 @@ static void cmWarnUnusedCliWarning(const std::string& variable, int /*unused*/, cmake* cm = reinterpret_cast<cmake*>(ctx); cm->MarkCliAsUsed(variable); } +#endif cmake::cmake(Role role, cmState::Mode mode) : FileTimeCache(cm::make_unique<cmFileTimeCache>()) diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 84d0538..2828116 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -318,6 +318,7 @@ int do_cmake(int ac, char const* const* av) return 0; } +#ifndef CMAKE_BOOTSTRAP int extract_job_number(int& index, char const* current, char const* next, int len_of_flag) { @@ -347,6 +348,7 @@ int extract_job_number(int& index, char const* current, char const* next, } return jobs; } +#endif int do_build(int ac, char const* const* av) { diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 3e16ab6..32e6582 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1477,7 +1477,7 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH endif() if(CMake_TEST_FindPython OR CMake_TEST_FindPython_NumPy - OR CMake_TEST_FindPython_Conda OR CMake_TEST_FindPython_IronPython) + OR CMake_TEST_FindPython_Conda OR CMake_TEST_FindPython_IronPython OR CMake_TEST_FindPython_PyPy) add_subdirectory(FindPython) endif() diff --git a/Tests/CMakeOnly/CheckLanguage/CMakeLists.txt b/Tests/CMakeOnly/CheckLanguage/CMakeLists.txt index 90aa921..1570c37 100644 --- a/Tests/CMakeOnly/CheckLanguage/CMakeLists.txt +++ b/Tests/CMakeOnly/CheckLanguage/CMakeLists.txt @@ -18,16 +18,16 @@ if(APPLE) list(APPEND LANGUAGES OBJC OBJCXX) endif() -foreach(lang ${LANGUAGES}) - check_language(${lang}) - if(NOT DEFINED CMAKE_${lang}_COMPILER) - message(FATAL_ERROR "check_language(${lang}) did not set result") +foreach(test_lang ${LANGUAGES}) + check_language(${test_lang}) + if(NOT DEFINED CMAKE_${test_lang}_COMPILER) + message(FATAL_ERROR "check_language(${test_lang}) did not set result") endif() - if(DEFINED expect_${lang}) - if(expect_${lang} AND NOT CMAKE_${lang}_COMPILER) - message(FATAL_ERROR "check_language(${lang}) should not fail!") - elseif(NOT expect_${lang} AND CMAKE_${lang}_COMPILER) - message(FATAL_ERROR "check_language(${lang}) should not succeed!") + if(DEFINED expect_${test_lang}) + if(expect_${test_lang} AND NOT CMAKE_${test_lang}_COMPILER) + message(FATAL_ERROR "check_language(${test_lang}) should not fail!") + elseif(NOT expect_${test_lang} AND CMAKE_${test_lang}_COMPILER) + message(FATAL_ERROR "check_language(${test_lang}) should not succeed!") endif() endif() endforeach() diff --git a/Tests/FindPython/CMakeLists.txt b/Tests/FindPython/CMakeLists.txt index 072a993..2cec030 100644 --- a/Tests/FindPython/CMakeLists.txt +++ b/Tests/FindPython/CMakeLists.txt @@ -400,3 +400,108 @@ if(CMake_TEST_FindPython_IronPython) --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) endif() + +if(CMake_TEST_FindPython_PyPy) + add_test(NAME FindPython.PyPy2.LOCATION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy2" + "${CMake_BINARY_DIR}/Tests/FindPython/PyPy2.LOCATION" + ${build_generator_args} + --build-project TestPyPy2 + --build-options ${build_options} -DPython2_FIND_STRATEGY=LOCATION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + add_test(NAME FindPython.PyPy2.VERSION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy2" + "${CMake_BINARY_DIR}/Tests/FindPython/PyPy2.VERSION" + ${build_generator_args} + --build-project TestPyPy2 + --build-options ${build_options} -DPython2_FIND_STRATEGY=VERSION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + + add_test(NAME FindPython.PyPy3.LOCATION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy3" + "${CMake_BINARY_DIR}/Tests/FindPython/PyPy3.LOCATION" + ${build_generator_args} + --build-project TestPyPy3 + --build-options ${build_options} -DPython3_FIND_STRATEGY=LOCATION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + add_test(NAME FindPython.PyPy3.VERSION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy3" + "${CMake_BINARY_DIR}/Tests/FindPython/PyPy3.VERSION" + ${build_generator_args} + --build-project TestPyPy3 + --build-options ${build_options} -DPython3_FIND_STRATEGY=VERSION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + + add_test(NAME FindPython.PyPy.LOCATION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy" + "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.LOCATION" + ${build_generator_args} + --build-project TestPyPy + --build-options ${build_options} -DPython_FIND_STRATEGY=LOCATION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + add_test(NAME FindPython.PyPy.VERSION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy" + "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.VERSION" + ${build_generator_args} + --build-project TestPyPy + --build-options ${build_options} -DPython_FIND_STRATEGY=VERSION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + add_test(NAME FindPython.PyPy.V2.LOCATION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy" + "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.V2.LOCATION" + ${build_generator_args} + --build-project TestPyPy + --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_FIND_STRATEGY=LOCATION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + add_test(NAME FindPython.PyPy.V2.VERSION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy" + "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.V2.VERSION" + ${build_generator_args} + --build-project TestPyPy + --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_FIND_STRATEGY=VERSION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + add_test(NAME FindPython.PyPy.V3.LOCATION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy" + "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.V3.LOCATION" + ${build_generator_args} + --build-project TestPyPy + --build-options ${build_options} -DPython_REQUESTED_VERSION=3 -DPython_FIND_STRATEGY=LOCATION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + add_test(NAME FindPython.PyPy.V3.VERSION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy" + "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.V3.VERSION" + ${build_generator_args} + --build-project TestPyPy + --build-options ${build_options} -DPython_REQUESTED_VERSION=3 -DPython_FIND_STRATEGY=VERSION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) +endif() diff --git a/Tests/FindPython/PyPy/CMakeLists.txt b/Tests/FindPython/PyPy/CMakeLists.txt new file mode 100644 index 0000000..b4ade8c --- /dev/null +++ b/Tests/FindPython/PyPy/CMakeLists.txt @@ -0,0 +1,37 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestPyPy C) + +set (Python_FIND_IMPLEMENTATIONS PyPy) + +find_package(Python ${Python_REQUESTED_VERSION} COMPONENTS Interpreter Development) +if (NOT Python_FOUND) + message (FATAL_ERROR "Fail to found Python PyPy ${Python_REQUESTED_VERSION}") +endif() + +if (NOT Python_Interpreter_FOUND) + message (FATAL_ERROR "Fail to found Python PyPy Interpreter") +endif() +if (NOT Python_INTERPRETER_ID STREQUAL "PyPy") + message (FATAL_ERROR "Erroneous interpreter ID (${Python_INTERPRETER_ID})") +endif() + +if (NOT Python_Development.Module_FOUND) + message (FATAL_ERROR "Fail to found Python PyPy ${Python_REQUESTED_VERSION} Development.Module") +endif() +if (NOT Python_Development.Embed_FOUND) + message (FATAL_ERROR "Fail to found Python PyPy ${Python_REQUESTED_VERSION} Development.Embed") +endif() +if (NOT Python_Development_FOUND) + message (FATAL_ERROR "Fail to found Python PyPy ${Python_REQUESTED_VERSION} Development") +endif() + +if(NOT TARGET Python::Interpreter) + message(SEND_ERROR "Python::Interpreter not found") +endif() +if(NOT TARGET Python::Module) + message(SEND_ERROR "Python::Module not found") +endif() +if(NOT TARGET Python::Python) + message(SEND_ERROR "Python::Python not found") +endif() diff --git a/Tests/FindPython/PyPy2/CMakeLists.txt b/Tests/FindPython/PyPy2/CMakeLists.txt new file mode 100644 index 0000000..2f0ddc9 --- /dev/null +++ b/Tests/FindPython/PyPy2/CMakeLists.txt @@ -0,0 +1,37 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestPyPy2 C) + +set (Python2_FIND_IMPLEMENTATIONS "PyPy") + +find_package(Python2 COMPONENTS Interpreter Development) +if (NOT Python2_FOUND) + message (FATAL_ERROR "Fail to found Python PyPy 2") +endif() + +if (NOT Python2_Interpreter_FOUND) + message (FATAL_ERROR "Fail to found Python PyPy 2 Interpreter") +endif() +if (NOT Python2_INTERPRETER_ID STREQUAL "PyPy") + message (FATAL_ERROR "Erroneous interpreter ID (${Python2_INTERPRETER_ID})") +endif() + +if (NOT Python2_Development.Module_FOUND) + message (FATAL_ERROR "Fail to found Python PyPy 2 Development.Module") +endif() +if (NOT Python2_Development.Embed_FOUND) + message (FATAL_ERROR "Fail to found Python PyPy 2 Development.Embed") +endif() +if (NOT Python2_Development_FOUND) + message (FATAL_ERROR "Fail to found Python PyPy 2 Development") +endif() + +if(NOT TARGET Python2::Interpreter) + message(SEND_ERROR "Python2::Interpreter not found") +endif() +if(NOT TARGET Python2::Module) + message(SEND_ERROR "Python2::Module not found") +endif() +if(NOT TARGET Python2::Python) + message(SEND_ERROR "Python2::Python not found") +endif() diff --git a/Tests/FindPython/PyPy3/CMakeLists.txt b/Tests/FindPython/PyPy3/CMakeLists.txt new file mode 100644 index 0000000..5562d57 --- /dev/null +++ b/Tests/FindPython/PyPy3/CMakeLists.txt @@ -0,0 +1,37 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestPyPy3 C) + +set (Python3_FIND_IMPLEMENTATIONS "PyPy") + +find_package(Python3 COMPONENTS Interpreter Development) +if (NOT Python3_FOUND) + message (FATAL_ERROR "Fail to found Python PyPy 3") +endif() + +if (NOT Python3_Interpreter_FOUND) + message (FATAL_ERROR "Fail to found Python PyPy 3 Interpreter") +endif() +if (NOT Python3_INTERPRETER_ID STREQUAL "PyPy") + message (FATAL_ERROR "Erroneous interpreter ID (${Python3_INTERPRETER_ID})") +endif() + +if (NOT Python3_Development.Module_FOUND) + message (FATAL_ERROR "Fail to found Python PyPy 3 Development.Module") +endif() +if (NOT Python3_Development.Embed_FOUND) + message (FATAL_ERROR "Fail to found Python PyPy 3 Development.Embed") +endif() +if (NOT Python3_Development_FOUND) + message (FATAL_ERROR "Fail to found Python PyPy 3 Development") +endif() + +if(NOT TARGET Python3::Interpreter) + message(SEND_ERROR "Python3::Interpreter not found") +endif() +if(NOT TARGET Python3::Module) + message(SEND_ERROR "Python3::Module not found") +endif() +if(NOT TARGET Python3::Python) + message(SEND_ERROR "Python3::Python not found") +endif() diff --git a/Tests/RunCMake/AutoExportDll/AutoExport.cmake b/Tests/RunCMake/AutoExportDll/AutoExport.cmake index a550005..85eff7e 100644 --- a/Tests/RunCMake/AutoExportDll/AutoExport.cmake +++ b/Tests/RunCMake/AutoExportDll/AutoExport.cmake @@ -5,6 +5,10 @@ add_subdirectory(sub) add_library(objlib OBJECT objlib.c) set_property(TARGET objlib PROPERTY POSITION_INDEPENDENT_CODE 1) add_library(autoexport SHARED hello.cxx world.cxx foo.c $<TARGET_OBJECTS:objlib>) +add_library(autoexport3 SHARED cppCLI.cxx) +if(MSVC AND NOT MSVC_VERSION VERSION_LESS 1600) + set_property(TARGET autoexport3 PROPERTY COMMON_LANGUAGE_RUNTIME "") +endif() add_executable(say say.cxx) if(MSVC) @@ -18,4 +22,4 @@ if(MSVC) target_compile_definitions(say PRIVATE HAS_JUSTNOP) endif() endif() -target_link_libraries(say autoexport autoexport2) +target_link_libraries(say autoexport autoexport2 autoexport3) diff --git a/Tests/RunCMake/AutoExportDll/cppCLI.cxx b/Tests/RunCMake/AutoExportDll/cppCLI.cxx new file mode 100644 index 0000000..816bb6e --- /dev/null +++ b/Tests/RunCMake/AutoExportDll/cppCLI.cxx @@ -0,0 +1,22 @@ +#include <stdio.h> + +#ifdef __cplusplus_cli +# include <msclr\marshal_cppstd.h> + +void cliFunction() +{ + System::String ^ result = "cliFunction"; + result = result->Trim(); + printf(msclr::interop::marshal_as<std::string>(result).c_str()); +} +#else +void cliFunction() +{ + printf("cliFunction (but /cli was not passed to the compiler)"); +} +#endif + +void nonCliFunction() +{ + printf("nonCliFunction"); +} diff --git a/Tests/RunCMake/AutoExportDll/say.cxx b/Tests/RunCMake/AutoExportDll/say.cxx index 654b5e0..8fc768a 100644 --- a/Tests/RunCMake/AutoExportDll/say.cxx +++ b/Tests/RunCMake/AutoExportDll/say.cxx @@ -17,9 +17,11 @@ void justnop(); } // test c++ functions -// forward declare hello and world +// forward declare hello, world, cliFunction and nonCliFunction void hello(); void world(); +void cliFunction(); +void nonCliFunction(); // test exports for executable target extern "C" { @@ -44,6 +46,10 @@ int main() bar(); objlib(); printf("\n"); + cliFunction(); + printf("\n"); + nonCliFunction(); + printf("\n"); #ifdef HAS_JUSTNOP justnop(); #endif diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake index 62bb5de..d697fc6 100644 --- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake @@ -99,6 +99,7 @@ file(WRITE ${fakePkgDir}/lib/pkgconfig/${pname}.pc Description: Dummy package for FindPkgConfig IMPORTED_TARGET INTERFACE_LINK_OPTIONS test Version: 1.2.3 Libs: -e dummy_main +Cflags: -I/special -isystem /other -isystem/more -DA-isystem/foo ") set(expected_link_options -e dummy_main) @@ -109,7 +110,26 @@ endif() get_target_property(link_options PkgConfig::FakeLinkOptionsPackage INTERFACE_LINK_OPTIONS) if (NOT link_options STREQUAL expected_link_options) message(FATAL_ERROR - "Additional link options not present in INTERFACE_LINK_OPTIONS property" + "Additional link options not present in INTERFACE_LINK_OPTIONS property\n" "expected: \"${expected_link_options}\", but got \"${link_options}\"" ) endif() + +get_target_property(inc_dirs PkgConfig::FakeLinkOptionsPackage INTERFACE_INCLUDE_DIRECTORIES) +set(expected_inc_dirs "/special" "/other" "/more") + +if (NOT inc_dirs STREQUAL expected_inc_dirs) + message(FATAL_ERROR + "Additional include directories not correctly present in INTERFACE_INCLUDE_DIRECTORIES property\n" + "expected: \"${expected_inc_dirs}\", got \"${inc_dirs}\"" + ) +endif () + +get_target_property(c_opts PkgConfig::FakeLinkOptionsPackage INTERFACE_COMPILE_OPTIONS) +set(expected_c_opts "-DA-isystem/foo") # this is an invalid option, but a good testcase +if (NOT c_opts STREQUAL expected_c_opts) + message(FATAL_ERROR + "Additional compile options not present in INTERFACE_COMPILE_OPTIONS property\n" + "expected: \"${expected_c_opts}\", got \"${c_opts}\"" + ) +endif () diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt index 5f7753d..7fb3919 100644 --- a/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt +++ b/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt @@ -1,22 +1,28 @@ Test project .* - Start 1: TEST:basic\.case_foo!1 -1/8 Test #1: TEST:basic\.case_foo!1 \.+ +Passed +[0-9.]+ sec - Start 2: TEST:basic\.case_bar!1 -2/8 Test #2: TEST:basic\.case_bar!1 \.+ +Passed +[0-9.]+ sec - Start 3: TEST:basic\.disabled_case!1 -3/8 Test #3: TEST:basic\.disabled_case!1 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec - Start 4: TEST:disabled\.case!1 -4/8 Test #4: TEST:disabled\.case!1 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec - Start 5: TEST:typed/short\.case!1 -5/8 Test #5: TEST:typed/short\.case!1 \.+ +Passed +[0-9.]+ sec - Start 6: TEST:typed/float\.case!1 -6/8 Test #6: TEST:typed/float\.case!1 \.+ +Passed +[0-9.]+ sec - Start 7: TEST:value/test\.case/1!1 -7/8 Test #7: TEST:value/test\.case/1!1 \.+ +Passed +[0-9.]+ sec - Start 8: TEST:value/test\.case/"foo"!1 -8/8 Test #8: TEST:value/test\.case/"foo"!1 \.+ +Passed +[0-9.]+ sec + Start 1: TEST:basic\.case_foo!1 + 1/11 Test #1: TEST:basic\.case_foo!1 \.+ +Passed +[0-9.]+ sec + Start 2: TEST:basic\.case_bar!1 + 2/11 Test #2: TEST:basic\.case_bar!1 \.+ +Passed +[0-9.]+ sec + Start 3: TEST:basic\.disabled_case!1 + 3/11 Test #3: TEST:basic\.disabled_case!1 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec + Start 4: TEST:disabled\.case!1 + 4/11 Test #4: TEST:disabled\.case!1 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec + Start 5: TEST:typed/short\.case!1 + 5/11 Test #5: TEST:typed/short\.case!1 \.+ +Passed +[0-9.]+ sec + Start 6: TEST:typed/float\.case!1 + 6/11 Test #6: TEST:typed/float\.case!1 \.+ +Passed +[0-9.]+ sec + Start 7: TEST:value/test\.case/1!1 + 7/11 Test #7: TEST:value/test\.case/1!1 \.+ +Passed +[0-9.]+ sec + Start 8: TEST:value/test\.case/"foo"!1 + 8/11 Test #8: TEST:value/test\.case/"foo"!1 \.+ +Passed +[0-9.]+ sec + Start 9: TEST:param/special\.case/"semicolon;"!1 + 9/11 Test #9: TEST:param/special\.case/"semicolon;"!1 \.+ +Passed +[0-9.]+ sec + Start 10: TEST:param/special\.case/"backslash\\"!1 +10/11 Test #10: TEST:param/special\.case/"backslash\\"!1 \.+ +Passed +[0-9.]+ sec + Start 11: TEST:param/special\.case/"\$\{var\}"!1 +11/11 Test #11: TEST:param/special\.case/"\$\{var\}"!1 \.+ +Passed +[0-9.]+ sec -100% tests passed, 0 tests failed out of 6 +100% tests passed, 0 tests failed out of 9 Total Test time \(real\) = +[0-9.]+ sec diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt index 960c0b9..58c4d10 100644 --- a/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt +++ b/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt @@ -1,25 +1,31 @@ Test project .* - Start 9: TEST:basic\.case_foo!2 -1/8 Test #9: TEST:basic\.case_foo!2 \.+ +Passed +[0-9.]+ sec - Start 10: TEST:basic\.case_bar!2 -2/8 Test #10: TEST:basic\.case_bar!2 \.+ +Passed +[0-9.]+ sec - Start 11: TEST:basic\.disabled_case!2 -3/8 Test #11: TEST:basic\.disabled_case!2 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec - Start 12: TEST:disabled\.case!2 -4/8 Test #12: TEST:disabled\.case!2 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec - Start 13: TEST:typed/short\.case!2 -5/8 Test #13: TEST:typed/short\.case!2 \.+ +Passed +[0-9.]+ sec - Start 14: TEST:typed/float\.case!2 -6/8 Test #14: TEST:typed/float\.case!2 \.+ +Passed +[0-9.]+ sec - Start 15: TEST:value/test\.case/1!2 -7/8 Test #15: TEST:value/test\.case/1!2 \.+ +Passed +[0-9.]+ sec - Start 16: TEST:value/test\.case/"foo"!2 -8/8 Test #16: TEST:value/test\.case/"foo"!2 \.+ +Passed +[0-9.]+ sec + Start 12: TEST:basic\.case_foo!2 + 1/11 Test #12: TEST:basic\.case_foo!2 \.+ +Passed +[0-9.]+ sec + Start 13: TEST:basic\.case_bar!2 + 2/11 Test #13: TEST:basic\.case_bar!2 \.+ +Passed +[0-9.]+ sec + Start 14: TEST:basic\.disabled_case!2 + 3/11 Test #14: TEST:basic\.disabled_case!2 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec + Start 15: TEST:disabled\.case!2 + 4/11 Test #15: TEST:disabled\.case!2 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec + Start 16: TEST:typed/short\.case!2 + 5/11 Test #16: TEST:typed/short\.case!2 \.+ +Passed +[0-9.]+ sec + Start 17: TEST:typed/float\.case!2 + 6/11 Test #17: TEST:typed/float\.case!2 \.+ +Passed +[0-9.]+ sec + Start 18: TEST:value/test\.case/1!2 + 7/11 Test #18: TEST:value/test\.case/1!2 \.+ +Passed +[0-9.]+ sec + Start 19: TEST:value/test\.case/"foo"!2 + 8/11 Test #19: TEST:value/test\.case/"foo"!2 \.+ +Passed +[0-9.]+ sec + Start 20: TEST:param/special\.case/"semicolon;"!2 + 9/11 Test #20: TEST:param/special\.case/"semicolon;"!2 \.+ +Passed +[0-9.]+ sec + Start 21: TEST:param/special\.case/"backslash\\"!2 +10/11 Test #21: TEST:param/special\.case/"backslash\\"!2 \.+ +Passed +[0-9.]+ sec + Start 22: TEST:param/special\.case/"\$\{var\}"!2 +11/11 Test #22: TEST:param/special\.case/"\$\{var\}"!2 \.+ +Passed +[0-9.]+ sec -100% tests passed, 0 tests failed out of 6 +100% tests passed, 0 tests failed out of 9 Total Test time \(real\) = +[0-9.]+ sec The following tests did not run: -.*11 - TEST:basic\.disabled_case!2 \(Disabled\) -.*12 - TEST:disabled\.case!2 \(Disabled\) +.*14 - TEST:basic\.disabled_case!2 \(Disabled\) +.*15 - TEST:disabled\.case!2 \(Disabled\) diff --git a/Tests/RunCMake/GoogleTest/fake_gtest.cpp b/Tests/RunCMake/GoogleTest/fake_gtest.cpp index f1bd7ef..a8127bf 100644 --- a/Tests/RunCMake/GoogleTest/fake_gtest.cpp +++ b/Tests/RunCMake/GoogleTest/fake_gtest.cpp @@ -21,6 +21,10 @@ int main(int argc, char** argv) std::cout << "value/test." << std::endl; std::cout << " case/0 # GetParam() = 1" << std::endl; std::cout << " case/1 # GetParam() = \"foo\"" << std::endl; + std::cout << "param/special." << std::endl; + std::cout << " case/0 # GetParam() = \"semicolon;\"" << std::endl; + std::cout << " case/1 # GetParam() = \"backslash\\\"" << std::endl; + std::cout << " case/2 # GetParam() = \"${var}\"" << std::endl; return 0; } @@ -46,7 +46,7 @@ cmake_install_dest_default() cmake_toupper() { - echo "$1" | tr '[:lower:]' '[:upper:]' + echo "$1" | tr '[a-z]' '[A-Z]' } # Detect system and directory information. @@ -60,7 +60,7 @@ cmake_version_minor="`cmake_version_component MINOR`" cmake_version_patch="`cmake_version_component PATCH`" cmake_version="${cmake_version_major}.${cmake_version_minor}.${cmake_version_patch}" cmake_version_rc="`cmake_version_component RC`" -if [ "$cmake_version_rc" != "" ]; then +if test "$cmake_version_rc" != ""; then cmake_version="${cmake_version}-rc${cmake_version_rc}" fi @@ -209,13 +209,13 @@ esac # Choose the default install prefix. if ${cmake_system_mingw}; then - if [ "x${PROGRAMFILES}" != "x" ]; then + if test "x${PROGRAMFILES}" != "x"; then cmake_default_prefix=`cmake_fix_slashes "${PROGRAMFILES}/CMake"` - elif [ "x${ProgramFiles}" != "x" ]; then + elif test "x${ProgramFiles}" != "x"; then cmake_default_prefix=`cmake_fix_slashes "${ProgramFiles}/CMake"` - elif [ "x${SYSTEMDRIVE}" != "x" ]; then + elif test "x${SYSTEMDRIVE}" != "x"; then cmake_default_prefix=`cmake_fix_slashes "${SYSTEMDRIVE}/Program Files/CMake"` - elif [ "x${SystemDrive}" != "x" ]; then + elif test "x${SystemDrive}" != "x"; then cmake_default_prefix=`cmake_fix_slashes "${SystemDrive}/Program Files/CMake"` else cmake_default_prefix="c:/Program Files/CMake" @@ -671,7 +671,7 @@ cmake_error() echo "Error when bootstrapping CMake:" echo "$*" echo "---------------------------------------------" - if [ -f cmake_bootstrap.log ]; then + if test -f cmake_bootstrap.log; then echo "Log of errors: `pwd`/cmake_bootstrap.log" #cat cmake_bootstrap.log echo "---------------------------------------------" @@ -698,9 +698,9 @@ cmake_replace_string () OUTFILE="$2" SEARCHFOR="$3" REPLACEWITH="$4" - if [ -f "${INFILE}" ] || ${cmake_system_openvms}; then + if test -f "${INFILE}" || ${cmake_system_openvms}; then sed "s/\@${SEARCHFOR}\@/${REPLACEWITH}/g" "${INFILE}" > "${OUTFILE}${_tmp}" - if [ -f "${OUTFILE}${_tmp}" ]; then + if test -f "${OUTFILE}${_tmp}"; then if "${_diff}" "${OUTFILE}" "${OUTFILE}${_tmp}" > /dev/null 2> /dev/null ; then #echo "Files are the same" rm -f "${OUTFILE}${_tmp}" @@ -719,7 +719,7 @@ cmake_kwsys_config_replace_string () OUTFILE="$2" shift 2 APPEND="$*" - if [ -f "${INFILE}" ] || ${cmake_system_openvms}; then + if test -f "${INFILE}" || ${cmake_system_openvms}; then echo "${APPEND}" > "${OUTFILE}${_tmp}" sed "/./ {s/\@KWSYS_NAMESPACE\@/cmsys/g; s/@KWSYS_BUILD_SHARED@/${KWSYS_BUILD_SHARED}/g; @@ -730,7 +730,7 @@ cmake_kwsys_config_replace_string () s/@KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H@/${KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H}/g; s/@KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP@/${KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP}/g; }" "${INFILE}" >> "${OUTFILE}${_tmp}" - if [ -f "${OUTFILE}${_tmp}" ]; then + if test -f "${OUTFILE}${_tmp}"; then if "${_diff}" "${OUTFILE}" "${OUTFILE}${_tmp}" > /dev/null 2> /dev/null ; then #echo "Files are the same" rm -f "${OUTFILE}${_tmp}" @@ -787,7 +787,7 @@ cmake_try_run () COMPILER=$1 FLAGS=$2 TESTFILE=$3 - if [ ! -f "${TESTFILE}" ]; then + if test ! -f "${TESTFILE}"; then echo "Test file ${TESTFILE} missing. Please verify your CMake source tree." exit 4 fi @@ -799,18 +799,18 @@ cmake_try_run () echo "------------------------------------------" "${COMPILER}" ${FLAGS} "${TESTFILE}" -o "${TMPFILE}" RES=$? - if [ "${RES}" -ne "0" ]; then + if test "${RES}" -ne "0"; then echo "Test failed to compile" return 1 fi - if [ ! -f "${TMPFILE}" ] && [ ! -f "${TMPFILE}.exe" ]; then + if test ! -f "${TMPFILE}" && test ! -f "${TMPFILE}.exe"; then echo "Test failed to produce executable" return 2 fi ./${TMPFILE} RES=$? rm -f "${TMPFILE}" - if [ "${RES}" -ne "0" ]; then + if test "${RES}" -ne "0"; then echo "Test produced non-zero return code" return 3 fi @@ -826,18 +826,18 @@ cmake_try_make () echo "Try: ${MAKE_PROC}" "${MAKE_PROC}" ${MAKE_FLAGS} RES=$? - if [ "${RES}" -ne "0" ]; then + if test "${RES}" -ne "0"; then echo "${MAKE_PROC} does not work" return 1 fi - if [ ! -f "test" ] && [ ! -f "test.exe" ]; then + if test ! -f "test" && test ! -f "test.exe"; then echo "${COMPILER} does not produce output" return 2 fi ./test RES=$? rm -f "test" - if [ "${RES}" -ne "0" ]; then + if test "${RES}" -ne "0"; then echo "${MAKE_PROC} produces strange executable" return 3 fi @@ -894,13 +894,13 @@ while test $# != 0; do done # If verbose, display some information about bootstrap -if [ -n "${cmake_verbose}" ]; then +if test -n "${cmake_verbose}"; then echo "---------------------------------------------" echo "Source directory: ${cmake_source_dir}" echo "Binary directory: ${cmake_binary_dir}" echo "Prefix directory: ${cmake_prefix_dir}" echo "System: ${cmake_system}" - if [ "x${cmake_parallel_make}" != "x" ]; then + if test "x${cmake_parallel_make}" != "x"; then echo "Doing parallel make: ${cmake_parallel_make}" fi echo "" @@ -912,18 +912,18 @@ echo "`cmake_version_display`" # Check for in-source build cmake_in_source_build= -if [ -f "${cmake_binary_dir}/Source/cmake.cxx" -a \ - -f "${cmake_binary_dir}/Source/cmake.h" ]; then - if [ -n "${cmake_verbose}" ]; then +if test -f "${cmake_binary_dir}/Source/cmake.cxx" && + test -f "${cmake_binary_dir}/Source/cmake.h"; then + if test -n "${cmake_verbose}"; then echo "Warning: This is an in-source build" fi cmake_in_source_build=TRUE fi # If this is not an in-source build, then Bootstrap stuff should not exist. -if [ -z "${cmake_in_source_build}" ]; then +if test -z "${cmake_in_source_build}"; then # Did somebody bootstrap in the source tree? - if [ -d "${cmake_source_dir}/Bootstrap${_cmk}" ]; then + if test -d "${cmake_source_dir}/Bootstrap${_cmk}"; then cmake_error 10 "Found directory \"${cmake_source_dir}/Bootstrap${_cmk}\". Looks like somebody did bootstrap CMake in the source tree, but now you are trying to do bootstrap in the binary tree. Please remove Bootstrap${_cmk} @@ -931,7 +931,7 @@ directory from the source tree." fi # Is there a cache in the source tree? for cmake_problematic_file in ${CMAKE_PROBLEMATIC_FILES}; do - if [ -f "${cmake_source_dir}/${cmake_problematic_file}" ]; then + if test -f "${cmake_source_dir}/${cmake_problematic_file}"; then cmake_error 10 "Found \"${cmake_source_dir}/${cmake_problematic_file}\". Looks like somebody tried to build CMake in the source tree, but now you are trying to do bootstrap in the binary tree. Please remove \"${cmake_problematic_file}\" @@ -941,14 +941,14 @@ from the source tree." fi # Make bootstrap directory -[ -d "${cmake_bootstrap_dir}" ] || mkdir "${cmake_bootstrap_dir}" -if [ ! -d "${cmake_bootstrap_dir}" ]; then +test -d "${cmake_bootstrap_dir}" || mkdir "${cmake_bootstrap_dir}" +if test ! -d "${cmake_bootstrap_dir}"; then cmake_error 3 "Cannot create directory ${cmake_bootstrap_dir} to bootstrap CMake." fi cd "${cmake_bootstrap_dir}" -[ -d "cmsys" ] || mkdir "cmsys" -if [ ! -d "cmsys" ]; then +test -d "cmsys" || mkdir "cmsys" +if test ! -d "cmsys"; then cmake_error 4 "Cannot create directory ${cmake_bootstrap_dir}/cmsys" fi @@ -959,7 +959,7 @@ rm -f "${cmake_bootstrap_dir}/cmVersionConfig.h${_tmp}" # If building in-source, remove any cmConfigure.h that may # have been created by a previous run of the bootstrap cmake. -if [ -n "${cmake_in_source_build}" ]; then +if test -n "${cmake_in_source_build}"; then rm -f "${cmake_source_dir}/Source/cmConfigure.h" fi @@ -1044,7 +1044,7 @@ cmake_toolchain_detect() done } -if [ -z "${CC}" -a -z "${CXX}" ]; then +if test -z "${CC}" && test -z "${CXX}"; then cmake_toolchain_detect fi @@ -1058,9 +1058,9 @@ esac cmake_c_compiler= # If CC is set, use that for compiler, otherwise use list of known compilers -if [ -n "${cmake_toolchain}" ]; then +if test -n "${cmake_toolchain}"; then eval cmake_c_compilers="\${cmake_toolchain_${cmake_toolchain}_CC}" -elif [ -n "${CC}" ]; then +elif test -n "${CC}"; then cmake_c_compilers="${CC}" else cmake_c_compilers="${CMAKE_KNOWN_C_COMPILERS}" @@ -1111,7 +1111,7 @@ for std in 11 99 90; do done rm -f "${TMPFILE}.c" -if [ -z "${cmake_c_compiler}" ]; then +if test -z "${cmake_c_compiler}"; then cmake_error 6 "Cannot find appropriate C compiler on this system. Please specify one using environment variable CC. See cmake_bootstrap.log for compilers attempted. @@ -1126,9 +1126,9 @@ cmake_cxx_compiler= # On Mac OSX, CC is the same as cc, so make sure not to try CC as c++ compiler. # If CC is set, use that for compiler, otherwise use list of known compilers -if [ -n "${cmake_toolchain}" ]; then +if test -n "${cmake_toolchain}"; then eval cmake_cxx_compilers="\${cmake_toolchain_${cmake_toolchain}_CXX}" -elif [ -n "${CXX}" ]; then +elif test -n "${CXX}"; then cmake_cxx_compilers="${CXX}" else cmake_cxx_compilers="${CMAKE_KNOWN_CXX_COMPILERS}" @@ -1232,7 +1232,7 @@ for std in 17 14 11; do done rm -f "${TMPFILE}.cxx" -if [ -z "${cmake_cxx_compiler}" ]; then +if test -z "${cmake_cxx_compiler}"; then cmake_error 7 "Cannot find a C++ compiler that supports both C++11 and the specified C++ flags. Please specify one using environment variable CXX. The C++ flags are \"$cmake_cxx_flags\". @@ -1259,7 +1259,7 @@ cmake_have_cxx_features="" for feature in ${cmake_cxx_features}; do feature_variable="cmake_have_cxx_${feature}" eval "feature_value=\${${feature_variable}}" - if [ "${feature_value}" -eq "1" ]; then + if test "${feature_value}" -eq "1"; then cmake_have_cxx_features="${cmake_have_cxx_features} -DCMake_HAVE_CXX_`cmake_toupper ${feature}`=${feature_value}" fi done @@ -1271,7 +1271,7 @@ cmake_make_processor= cmake_make_flags= # If MAKE is set, use that for make processor, otherwise use list of known make -if [ -n "${MAKE}" ]; then +if test -n "${MAKE}"; then cmake_make_processors="${MAKE}" else cmake_make_processors="${CMAKE_KNOWN_MAKE_PROCESSORS}" @@ -1290,20 +1290,20 @@ echo ' int main(){ printf("1%c", (char)0x0a); return 0; } ' > "test.c" cmake_original_make_flags="${cmake_make_flags}" -if [ "x${cmake_parallel_make}" != "x" ]; then +if test "x${cmake_parallel_make}" != "x"; then cmake_make_flags="${cmake_make_flags} -j ${cmake_parallel_make}" fi for a in ${cmake_make_processors}; do - if [ -z "${cmake_make_processor}" ] && cmake_try_make "${a}" "${cmake_make_flags}" >> ../cmake_bootstrap.log 2>&1; then + if test -z "${cmake_make_processor}" && cmake_try_make "${a}" "${cmake_make_flags}" >> ../cmake_bootstrap.log 2>&1; then cmake_make_processor="${a}" fi done cmake_full_make_flags="${cmake_make_flags}" -if [ "x${cmake_original_make_flags}" != "x${cmake_make_flags}" ]; then - if [ -z "${cmake_make_processor}" ]; then +if test "x${cmake_original_make_flags}" != "x${cmake_make_flags}"; then + if test -z "${cmake_make_processor}"; then cmake_make_flags="${cmake_original_make_flags}" for a in ${cmake_make_processors}; do - if [ -z "${cmake_make_processor}" ] && cmake_try_make "${a}" "${cmake_make_flags}" >> ../cmake_bootstrap.log 2>&1; then + if test -z "${cmake_make_processor}" && cmake_try_make "${a}" "${cmake_make_flags}" >> ../cmake_bootstrap.log 2>&1; then cmake_make_processor="${a}" fi done @@ -1311,13 +1311,13 @@ if [ "x${cmake_original_make_flags}" != "x${cmake_make_flags}" ]; then fi cd "${cmake_bootstrap_dir}" -if [ -z "${cmake_make_processor}" ]; then +if test -z "${cmake_make_processor}"; then cmake_error 8 "Cannot find appropriate Makefile processor on this system. Please specify one using environment variable MAKE." fi rm -rf "${cmake_bootstrap_dir}/${TMPFILE}" echo "Makefile processor on this system is: ${cmake_make_processor}" -if [ "x${cmake_full_make_flags}" != "x${cmake_make_flags}" ]; then +if test "x${cmake_full_make_flags}" != "x${cmake_make_flags}"; then echo "---------------------------------------------" echo "Makefile processor ${cmake_make_processor} does not support parallel build" echo "---------------------------------------------" @@ -1382,7 +1382,7 @@ else echo "${cmake_cxx_compiler} does not have <ext/stdio_filebuf.h>" fi -if [ -n "${cmake_ccache_enabled}" ]; then +if test -n "${cmake_ccache_enabled}"; then echo "Building CMake with ccache" cmake_c_compiler="ccache ${cmake_c_compiler}" cmake_cxx_compiler="ccache ${cmake_cxx_compiler}" @@ -1532,15 +1532,15 @@ else fi uv_c_flags="${uv_c_flags} `cmake_escape "-I${cmake_source_dir}/Utilities/cmlibuv/src"`" -if [ "x${cmake_ansi_cxx_flags}" != "x" ]; then +if test "x${cmake_ansi_cxx_flags}" != "x"; then cmake_cxx_flags="${cmake_ansi_cxx_flags} ${cmake_cxx_flags}" fi -if [ "x${cmake_c_flags}" != "x" ]; then +if test "x${cmake_c_flags}" != "x"; then cmake_c_flags="${cmake_c_flags} " fi -if [ "x${cmake_cxx_flags}" != "x" ]; then +if test "x${cmake_cxx_flags}" != "x"; then cmake_cxx_flags="${cmake_cxx_flags} " fi @@ -1637,42 +1637,42 @@ set (CMAKE_XDGDATA_DIR "'"${cmake_xdgdata_dir}"'" CACHE PATH "Install location f ' > "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" # Add configuration settings given as command-line options. -if [ "x${cmake_bootstrap_qt_gui}" != "x" ]; then +if test "x${cmake_bootstrap_qt_gui}" != "x"; then echo ' set (BUILD_QtDialog '"${cmake_bootstrap_qt_gui}"' CACHE BOOL "Build Qt dialog for CMake" FORCE) ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" fi -if [ "x${cmake_bootstrap_qt_qmake}" != "x" ]; then +if test "x${cmake_bootstrap_qt_qmake}" != "x"; then echo ' set (QT_QMAKE_EXECUTABLE "'"${cmake_bootstrap_qt_qmake}"'" CACHE FILEPATH "Location of Qt qmake" FORCE) ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" fi -if [ "x${cmake_sphinx_info}" != "x" ]; then +if test "x${cmake_sphinx_info}" != "x"; then echo ' set (SPHINX_INFO "'"${cmake_sphinx_info}"'" CACHE BOOL "Build Info manual with Sphinx" FORCE) ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" fi -if [ "x${cmake_sphinx_man}" != "x" ]; then +if test "x${cmake_sphinx_man}" != "x"; then echo ' set (SPHINX_MAN "'"${cmake_sphinx_man}"'" CACHE BOOL "Build man pages with Sphinx" FORCE) ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" fi -if [ "x${cmake_sphinx_html}" != "x" ]; then +if test "x${cmake_sphinx_html}" != "x"; then echo ' set (SPHINX_HTML "'"${cmake_sphinx_html}"'" CACHE BOOL "Build html help with Sphinx" FORCE) ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" fi -if [ "x${cmake_sphinx_qthelp}" != "x" ]; then +if test "x${cmake_sphinx_qthelp}" != "x"; then echo ' set (SPHINX_QTHELP "'"${cmake_sphinx_qthelp}"'" CACHE BOOL "Build qch help with Sphinx" FORCE) ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" fi -if [ "x${cmake_sphinx_build}" != "x" ]; then +if test "x${cmake_sphinx_build}" != "x"; then echo ' set (SPHINX_EXECUTABLE "'"${cmake_sphinx_build}"'" CACHE FILEPATH "Location of Qt sphinx-build" FORCE) ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" fi -if [ "x${cmake_sphinx_flags}" != "x" ]; then +if test "x${cmake_sphinx_flags}" != "x"; then echo ' set (SPHINX_FLAGS [==['"${cmake_sphinx_flags}"']==] CACHE STRING "Flags to pass to sphinx-build" FORCE) ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" @@ -1682,7 +1682,7 @@ fi # specification of cmake_init_file. ( cd "${cmake_binary_dir}" -if [ -f "${cmake_init_file}" ]; then +if test -f "${cmake_init_file}"; then cat "${cmake_init_file}" >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" fi ) @@ -1690,13 +1690,13 @@ fi echo "---------------------------------------------" # Run make to build bootstrap cmake -if [ "x${cmake_parallel_make}" != "x" ]; then +if test "x${cmake_parallel_make}" != "x"; then ${cmake_make_processor} ${cmake_make_flags} else ${cmake_make_processor} fi RES=$? -if [ "${RES}" -ne "0" ]; then +if test "${RES}" -ne "0"; then cmake_error 9 "Problem while running ${cmake_make_processor}" fi cd "${cmake_binary_dir}" @@ -1715,12 +1715,12 @@ export LDFLAGS # Run bootstrap CMake to configure real CMake cmake_options="-DCMAKE_BOOTSTRAP=1" -if [ -n "${cmake_verbose}" ]; then +if test -n "${cmake_verbose}"; then cmake_options="${cmake_options} -DCMAKE_VERBOSE_MAKEFILE=1" fi "${cmake_bootstrap_dir}/cmake" "${cmake_source_dir}" "-C${cmake_bootstrap_dir}/InitialCacheFlags.cmake" "-G${cmake_bootstrap_generator}" ${cmake_options} ${cmake_bootstrap_system_libs} "$@" RES=$? -if [ "${RES}" -ne "0" ]; then +if test "${RES}" -ne "0"; then cmake_error 11 "Problem while running initial CMake" fi |