From ddbda72288f022fa558d8253c8894687634448c1 Mon Sep 17 00:00:00 2001 From: James Johnston Date: Thu, 3 Dec 2015 19:10:19 +0000 Subject: [PATCH 1/5] Embarcadero: Fix bug where duplicate Ninja job pools would be created. If the platform file was included multiple times, it was possible that duplicate Ninja job pools would be created. --- Modules/Platform/Windows-Embarcadero.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Modules/Platform/Windows-Embarcadero.cmake b/Modules/Platform/Windows-Embarcadero.cmake index 5295a48e6..102e3a651 100644 --- a/Modules/Platform/Windows-Embarcadero.cmake +++ b/Modules/Platform/Windows-Embarcadero.cmake @@ -78,7 +78,11 @@ set (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_SHARED_LINKER_FLAGS_R # invocations within a single working directory. if(NOT DEFINED CMAKE_JOB_POOL_LINK) set(CMAKE_JOB_POOL_LINK BCC32LinkPool) - set_property(GLOBAL APPEND PROPERTY JOB_POOLS BCC32LinkPool=1) + get_property(_bccjp GLOBAL PROPERTY JOB_POOLS) + if(NOT _bccjp MATCHES "BCC32LinkPool=") + set_property(GLOBAL APPEND PROPERTY JOB_POOLS BCC32LinkPool=1) + endif() + unset(_bccjp) endif() macro(__embarcadero_language lang) From f3b3219c9687e54a83dc7e5dabb0afc4637bb799 Mon Sep 17 00:00:00 2001 From: James Johnston Date: Thu, 3 Dec 2015 19:36:13 +0000 Subject: [PATCH 2/5] Embarcadero/Watcom: Properly skip VSResource test for other generators. This test should be skipped based on the chosen compiler, not the chosen generator. --- Tests/CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 5fd7159a5..06eb62970 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -269,8 +269,7 @@ if(BUILD_TESTING) set(TEST_RESOURCES TRUE) endif() # for borland and watcom there is no resource support - if("${CMAKE_GENERATOR}" MATCHES "WMake" OR - "${CMAKE_GENERATOR}" MATCHES "Borland") + if(WATCOM OR BORLAND) set(TEST_RESOURCES FALSE) endif() if(TEST_RESOURCES) From 060442c2e866c44ecf0c479e49e1d5ae35e8c6fb Mon Sep 17 00:00:00 2001 From: James Johnston Date: Thu, 3 Dec 2015 20:42:30 +0000 Subject: [PATCH 3/5] Embarcadero: Check code using CMAKE_CXX_COMPILER_ID and CMAKE_C_COMPILER_ID. The CMAKE_CXX_COMPILER_ID and CMAKE_C_COMPILER_ID variables are set to "Borland" for older versions of the compiler. Newer CodeGear/Embarcadero compilers will have those variables set to "Embarcadero". Search for lines of code referencing both the variable name and Borland to be sure that they also refer to Embarcadero. --- Modules/GenerateExportHeader.cmake | 4 ++++ Tests/CompileOptions/CMakeLists.txt | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake index 82054256a..4f4efbcf3 100644 --- a/Modules/GenerateExportHeader.cmake +++ b/Modules/GenerateExportHeader.cmake @@ -230,7 +230,11 @@ macro(_test_compiler_hidden_visibility) endmacro() macro(_test_compiler_has_deprecated) + # NOTE: Some Embarcadero compilers silently compile __declspec(deprecated) + # without error, but this is not a documented feature and the attribute does + # not actually generate any warnings. if(CMAKE_CXX_COMPILER_ID MATCHES Borland + OR CMAKE_CXX_COMPILER_ID MATCHES Embarcadero OR CMAKE_CXX_COMPILER_ID MATCHES HP OR GCC_TOO_OLD OR CMAKE_CXX_COMPILER_ID MATCHES PGI diff --git a/Tests/CompileOptions/CMakeLists.txt b/Tests/CompileOptions/CMakeLists.txt index 05a5f826f..692e0de0c 100644 --- a/Tests/CompileOptions/CMakeLists.txt +++ b/Tests/CompileOptions/CMakeLists.txt @@ -22,7 +22,7 @@ set_property(TARGET CompileOptions PROPERTY COMPILE_OPTIONS ${cxx_tests} ) -if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|Borland") +if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|Borland|Embarcadero") set_property(TARGET CompileOptions APPEND PROPERTY COMPILE_OPTIONS "-DTEST_OCTOTHORPE=\"#\"" ) From 25211d756fad353e96d29e289d40d780a5341c92 Mon Sep 17 00:00:00 2001 From: James Johnston Date: Thu, 3 Dec 2015 21:17:26 +0000 Subject: [PATCH 4/5] Compiler ID: Compiler versions must be a valid, numeric version string. This test helps catch errors in compiler identification. --- Tests/CMakeOnly/CompilerIdC/CMakeLists.txt | 7 +++++++ Tests/CMakeOnly/CompilerIdCXX/CMakeLists.txt | 7 +++++++ Tests/CMakeOnly/CompilerIdFortran/CMakeLists.txt | 7 +++++++ 3 files changed, 21 insertions(+) diff --git a/Tests/CMakeOnly/CompilerIdC/CMakeLists.txt b/Tests/CMakeOnly/CompilerIdC/CMakeLists.txt index 848ffdd36..6fea73eb8 100644 --- a/Tests/CMakeOnly/CompilerIdC/CMakeLists.txt +++ b/Tests/CMakeOnly/CompilerIdC/CMakeLists.txt @@ -12,3 +12,10 @@ foreach(v message(SEND_ERROR "${v} not set!") endif() endforeach() + +# Version numbers may only contain numbers and periods. +if(NOT CMAKE_C_COMPILER_VERSION MATCHES + "^([0-9]+)(\\.([0-9]+))?(\\.([0-9]+))?(\\.([0-9]+))?$" + ) + message(SEND_ERROR "Compiler version is not numeric!") +endif() diff --git a/Tests/CMakeOnly/CompilerIdCXX/CMakeLists.txt b/Tests/CMakeOnly/CompilerIdCXX/CMakeLists.txt index 94ac31e4c..05e6bb222 100644 --- a/Tests/CMakeOnly/CompilerIdCXX/CMakeLists.txt +++ b/Tests/CMakeOnly/CompilerIdCXX/CMakeLists.txt @@ -12,3 +12,10 @@ foreach(v message(SEND_ERROR "${v} not set!") endif() endforeach() + +# Version numbers may only contain numbers and periods. +if(NOT CMAKE_CXX_COMPILER_VERSION MATCHES + "^([0-9]+)(\\.([0-9]+))?(\\.([0-9]+))?(\\.([0-9]+))?$" + ) + message(SEND_ERROR "Compiler version is not numeric!") +endif() diff --git a/Tests/CMakeOnly/CompilerIdFortran/CMakeLists.txt b/Tests/CMakeOnly/CompilerIdFortran/CMakeLists.txt index 02e466887..067fb8cd3 100644 --- a/Tests/CMakeOnly/CompilerIdFortran/CMakeLists.txt +++ b/Tests/CMakeOnly/CompilerIdFortran/CMakeLists.txt @@ -12,3 +12,10 @@ foreach(v message(SEND_ERROR "${v} not set!") endif() endforeach() + +# Version numbers may only contain numbers and periods. +if(NOT CMAKE_Fortran_COMPILER_VERSION MATCHES + "^([0-9]+)(\\.([0-9]+))?(\\.([0-9]+))?(\\.([0-9]+))?$" + ) + message(SEND_ERROR "Compiler version is not numeric!") +endif() From 7a3277276e69c92d0f69674cdc27bae11bcbc14f Mon Sep 17 00:00:00 2001 From: James Johnston Date: Thu, 3 Dec 2015 21:24:56 +0000 Subject: [PATCH 5/5] Embarcadero: Fix erroneous interpretation of __CODEGEARC_VERSION__. As per the following link: http://docwiki.embarcadero.com/RADStudio/Seattle/en/Example_of_CODEGEARC_VERSION_Macro The major/minor versions must be decoded as a hex string, while the patch version must be decoded as a normal decimal string. As an example, C++ Builder XE 8.1's bcc32.exe sets this macro to 0x070189C9. The file version of bcc32.exe is 7.1.5570.35273. Therefore, the correct interpretation to COMPILER_VERSION would be 7.1.35273. --- Modules/Compiler/Embarcadero-DetermineCompiler.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Compiler/Embarcadero-DetermineCompiler.cmake b/Modules/Compiler/Embarcadero-DetermineCompiler.cmake index 2feedac35..8375624e9 100644 --- a/Modules/Compiler/Embarcadero-DetermineCompiler.cmake +++ b/Modules/Compiler/Embarcadero-DetermineCompiler.cmake @@ -4,4 +4,4 @@ set(_compiler_id_pp_test "defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__ set(_compiler_id_version_compute " # define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__CODEGEARC_VERSION__>>24 & 0x00FF) # define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__CODEGEARC_VERSION__>>16 & 0x00FF) -# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_HEX@(__CODEGEARC_VERSION__ & 0xFFFF)") +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__CODEGEARC_VERSION__ & 0xFFFF)")