mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-15 03:48:02 +08:00
Tests: Cover CMP0203 and CMP0204 on all platforms
This commit is contained in:

committed by
Brad King

parent
6874efb592
commit
b554dead95
@@ -1438,20 +1438,12 @@ if(CMake_TEST_Emscripten_TOOLCHAINS)
|
||||
set_property(TEST RunCMake.Emscripten APPEND PROPERTY LABELS "Emscripten")
|
||||
endif()
|
||||
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "MSVC" OR CMAKE_C_SIMULATE_ID STREQUAL "MSVC")
|
||||
add_RunCMake_test(SharedLibraryDefines
|
||||
-DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}
|
||||
-DCMAKE_C_SIMULATE_ID=${CMAKE_C_SIMULATE_ID}
|
||||
-DCMake_TEST_CUDA=${CMake_TEST_CUDA}
|
||||
)
|
||||
set_property(TEST RunCMake.SharedLibraryDefines APPEND PROPERTY LABELS "CUDA")
|
||||
endif()
|
||||
add_RunCMake_test(SharedLibraryDefines
|
||||
-DCMake_TEST_CUDA=${CMake_TEST_CUDA}
|
||||
)
|
||||
set_property(TEST RunCMake.SharedLibraryDefines APPEND PROPERTY LABELS "CUDA")
|
||||
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "MSVC" OR CMAKE_C_SIMULATE_ID STREQUAL "MSVC")
|
||||
add_RunCMake_test(MsvcCharsetDefines
|
||||
-DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}
|
||||
-DCMAKE_C_SIMULATE_ID=${CMAKE_C_SIMULATE_ID}
|
||||
-DCMake_TEST_CUDA=${CMake_TEST_CUDA}
|
||||
)
|
||||
set_property(TEST RunCMake.MsvcCharsetDefines APPEND PROPERTY LABELS "CUDA")
|
||||
endif()
|
||||
add_RunCMake_test(MsvcCharsetDefines
|
||||
-DCMake_TEST_CUDA=${CMake_TEST_CUDA}
|
||||
)
|
||||
set_property(TEST RunCMake.MsvcCharsetDefines APPEND PROPERTY LABELS "CUDA")
|
||||
|
@@ -4,8 +4,10 @@
|
||||
# ifndef _MBCS
|
||||
# error "_MBCS is not defined, but it should be"
|
||||
# endif
|
||||
# if _MBCS != 1
|
||||
# error "_MBCS is not defined as 1, but it should be"
|
||||
# if !defined(__BORLANDC__)
|
||||
# if _MBCS != 1
|
||||
# error "_MBCS is not defined as 1, but it should be"
|
||||
# endif
|
||||
# endif
|
||||
#else
|
||||
# ifdef _MBCS
|
||||
@@ -17,8 +19,10 @@
|
||||
# ifndef _SBCS
|
||||
# error "_SBCS is not defined, but it should be"
|
||||
# endif
|
||||
# if _SBCS != 1
|
||||
# error "_SBCS is not defined as 1, but it should be"
|
||||
# if !defined(__BORLANDC__)
|
||||
# if _SBCS != 1
|
||||
# error "_SBCS is not defined as 1, but it should be"
|
||||
# endif
|
||||
# endif
|
||||
#else
|
||||
# ifdef _SBCS
|
||||
@@ -30,8 +34,10 @@
|
||||
# ifndef _UNICODE
|
||||
# error "_UNICODE is not defined, but it should be"
|
||||
# endif
|
||||
# if _UNICODE != 1
|
||||
# error "_UNICODE is not defined as 1, but it should be"
|
||||
# if !defined(__BORLANDC__)
|
||||
# if _UNICODE != 1
|
||||
# error "_UNICODE is not defined as 1, but it should be"
|
||||
# endif
|
||||
# endif
|
||||
#else
|
||||
# ifdef _UNICODE
|
||||
@@ -39,7 +45,7 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
int FUNCTION()
|
||||
int FUNCTION(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@@ -48,7 +48,8 @@ foreach(policy_value IN ITEMS OLD WARN NEW)
|
||||
if (CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
# Visual Studio always defines `_MBCS` by default
|
||||
set(expected_define "MBCS")
|
||||
elseif (policy_value STREQUAL "NEW")
|
||||
elseif (policy_value STREQUAL "NEW" AND
|
||||
("${CMAKE_${language}_COMPILER_ID}" STREQUAL "MSVC" OR "${CMAKE_${language}_SIMULATE_ID}" STREQUAL "MSVC"))
|
||||
set(expected_define "MBCS")
|
||||
endif()
|
||||
msvcCharsetDefs_addTests(${policy_value} Default "${expected_define}" "")
|
||||
|
@@ -13,7 +13,7 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
int FUNCTION()
|
||||
int FUNCTION(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@@ -29,4 +29,6 @@ endif()
|
||||
|
||||
sharedLibraryDefs_addTests(NEW)
|
||||
|
||||
target_compile_definitions(${language}-CMP0203_NEW_shared PRIVATE "MUST_HAVE_DEFINE")
|
||||
if ("${CMAKE_${language}_COMPILER_ID}" STREQUAL "MSVC" OR "${CMAKE_${language}_SIMULATE_ID}" STREQUAL "MSVC")
|
||||
target_compile_definitions(${language}-CMP0203_NEW_shared PRIVATE "MUST_HAVE_DEFINE")
|
||||
endif()
|
||||
|
Reference in New Issue
Block a user