mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-16 22:37:30 +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")
|
set_property(TEST RunCMake.Emscripten APPEND PROPERTY LABELS "Emscripten")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (CMAKE_C_COMPILER_ID STREQUAL "MSVC" OR CMAKE_C_SIMULATE_ID STREQUAL "MSVC")
|
add_RunCMake_test(SharedLibraryDefines
|
||||||
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}
|
-DCMake_TEST_CUDA=${CMake_TEST_CUDA}
|
||||||
)
|
)
|
||||||
set_property(TEST RunCMake.SharedLibraryDefines APPEND PROPERTY LABELS "CUDA")
|
set_property(TEST RunCMake.SharedLibraryDefines APPEND PROPERTY LABELS "CUDA")
|
||||||
endif()
|
|
||||||
|
|
||||||
if (CMAKE_C_COMPILER_ID STREQUAL "MSVC" OR CMAKE_C_SIMULATE_ID STREQUAL "MSVC")
|
add_RunCMake_test(MsvcCharsetDefines
|
||||||
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}
|
-DCMake_TEST_CUDA=${CMake_TEST_CUDA}
|
||||||
)
|
)
|
||||||
set_property(TEST RunCMake.MsvcCharsetDefines APPEND PROPERTY LABELS "CUDA")
|
set_property(TEST RunCMake.MsvcCharsetDefines APPEND PROPERTY LABELS "CUDA")
|
||||||
endif()
|
|
||||||
|
@@ -4,9 +4,11 @@
|
|||||||
# ifndef _MBCS
|
# ifndef _MBCS
|
||||||
# error "_MBCS is not defined, but it should be"
|
# error "_MBCS is not defined, but it should be"
|
||||||
# endif
|
# endif
|
||||||
|
# if !defined(__BORLANDC__)
|
||||||
# if _MBCS != 1
|
# if _MBCS != 1
|
||||||
# error "_MBCS is not defined as 1, but it should be"
|
# error "_MBCS is not defined as 1, but it should be"
|
||||||
# endif
|
# endif
|
||||||
|
# endif
|
||||||
#else
|
#else
|
||||||
# ifdef _MBCS
|
# ifdef _MBCS
|
||||||
# error "_MBCS is defined, but it should not be"
|
# error "_MBCS is defined, but it should not be"
|
||||||
@@ -17,9 +19,11 @@
|
|||||||
# ifndef _SBCS
|
# ifndef _SBCS
|
||||||
# error "_SBCS is not defined, but it should be"
|
# error "_SBCS is not defined, but it should be"
|
||||||
# endif
|
# endif
|
||||||
|
# if !defined(__BORLANDC__)
|
||||||
# if _SBCS != 1
|
# if _SBCS != 1
|
||||||
# error "_SBCS is not defined as 1, but it should be"
|
# error "_SBCS is not defined as 1, but it should be"
|
||||||
# endif
|
# endif
|
||||||
|
# endif
|
||||||
#else
|
#else
|
||||||
# ifdef _SBCS
|
# ifdef _SBCS
|
||||||
# error "_SBCS is defined, but it should not be"
|
# error "_SBCS is defined, but it should not be"
|
||||||
@@ -30,16 +34,18 @@
|
|||||||
# ifndef _UNICODE
|
# ifndef _UNICODE
|
||||||
# error "_UNICODE is not defined, but it should be"
|
# error "_UNICODE is not defined, but it should be"
|
||||||
# endif
|
# endif
|
||||||
|
# if !defined(__BORLANDC__)
|
||||||
# if _UNICODE != 1
|
# if _UNICODE != 1
|
||||||
# error "_UNICODE is not defined as 1, but it should be"
|
# error "_UNICODE is not defined as 1, but it should be"
|
||||||
# endif
|
# endif
|
||||||
|
# endif
|
||||||
#else
|
#else
|
||||||
# ifdef _UNICODE
|
# ifdef _UNICODE
|
||||||
# error "_UNICODE is defined, but it should not be"
|
# error "_UNICODE is defined, but it should not be"
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int FUNCTION()
|
int FUNCTION(void)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -48,7 +48,8 @@ foreach(policy_value IN ITEMS OLD WARN NEW)
|
|||||||
if (CMAKE_GENERATOR MATCHES "Visual Studio")
|
if (CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||||
# Visual Studio always defines `_MBCS` by default
|
# Visual Studio always defines `_MBCS` by default
|
||||||
set(expected_define "MBCS")
|
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")
|
set(expected_define "MBCS")
|
||||||
endif()
|
endif()
|
||||||
msvcCharsetDefs_addTests(${policy_value} Default "${expected_define}" "")
|
msvcCharsetDefs_addTests(${policy_value} Default "${expected_define}" "")
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int FUNCTION()
|
int FUNCTION(void)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -29,4 +29,6 @@ endif()
|
|||||||
|
|
||||||
sharedLibraryDefs_addTests(NEW)
|
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