diff --git a/Modules/Platform/Windows-PellesC.cmake b/Modules/Platform/Windows-PellesC.cmake index b30c7e2475..ace812dded 100644 --- a/Modules/Platform/Windows-PellesC.cmake +++ b/Modules/Platform/Windows-PellesC.cmake @@ -21,4 +21,9 @@ macro(__windows_compiler_pellesc lang) set(CMAKE_${lang}_CREATE_WIN32_EXE "-subsystem:windows") set(CMAKE_${lang}_CREATE_CONSOLE_EXE "-subsystem:console") + + if(NOT CMAKE_RC_COMPILER_INIT) + set(CMAKE_RC_COMPILER_INIT porc) + endif() + enable_language(RC) endmacro() diff --git a/Modules/Platform/Windows-porc.cmake b/Modules/Platform/Windows-porc.cmake new file mode 100644 index 0000000000..a251a132d5 --- /dev/null +++ b/Modules/Platform/Windows-porc.cmake @@ -0,0 +1 @@ +set(CMAKE_RC_COMPILE_OBJECT " -Fo ") diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index deb338eb97..8ee9d75345 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -444,6 +444,7 @@ if(BUILD_TESTING) if(CMake_TEST_RESOURCES) ADD_TEST_MACRO(VSResource VSResource) + set_property(TEST VSResource APPEND PROPERTY LABELS "PellesC") if(CMAKE_GENERATOR MATCHES "Ninja") add_test_macro(VSResourceNinjaForceRSP VSResourceNinjaForceRSP) endif() diff --git a/Tests/VSResource/CMakeLists.txt b/Tests/VSResource/CMakeLists.txt index 55e924e986..62b4888d66 100644 --- a/Tests/VSResource/CMakeLists.txt +++ b/Tests/VSResource/CMakeLists.txt @@ -13,9 +13,8 @@ message(STATUS "CMAKE_RC_COMPILER='${CMAKE_RC_COMPILER}'") # add_definitions is fine for simple definitions (with no spaces and no # quoting), but requires avoidance or work-arounds beyond that... -if(CMAKE_RC_COMPILER MATCHES windres) +if(CMAKE_RC_COMPILER MATCHES "(windres|porc)") # windres rc compiler does not properly define quoted /D values as strings - message(STATUS "CMAKE_RC_COMPILER MATCHES windres") add_definitions(/DCMAKE_RCDEFINE=test.txt) add_definitions(/DCMAKE_RCDEFINE_NO_QUOTED_STRINGS) if(CMAKE_CURRENT_BINARY_DIR MATCHES " ") @@ -45,10 +44,13 @@ else() include_directories(${CMAKE_CURRENT_BINARY_DIR}) endif() -add_library(ResourceLib STATIC lib.c lib.rc) - add_executable(VSResource main.c test.rc) -target_link_libraries(VSResource ResourceLib) + +if(NOT CMAKE_AR MATCHES "polib") + add_library(ResourceLib STATIC lib.c lib.rc) + target_link_libraries(VSResource PRIVATE ResourceLib) + target_compile_definitions(VSResource PRIVATE HAVE_RESOURCE_LIB) +endif() if(MSVC AND NOT MSVC_VERSION VERSION_LESS 1600) set_property(SOURCE test.rc PROPERTY COMPILE_FLAGS /nologo) diff --git a/Tests/VSResource/main.c b/Tests/VSResource/main.c index 68078d1a8f..5a58644fa7 100644 --- a/Tests/VSResource/main.c +++ b/Tests/VSResource/main.c @@ -2,7 +2,9 @@ #include +#ifdef HAVE_RESOURCE_LIB extern int lib(void); +#endif struct x { @@ -76,5 +78,9 @@ int main(int argc, char** argv) } } - return ret + lib(); + return ret +#ifdef HAVE_RESOURCE_LIB + + lib() +#endif + ; }