mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-08 07:10:12 -05:00
Explicitly specify language flag when source LANGUAGE property is set
Fixes: #14516, #20716
This commit is contained in:
@@ -8,3 +8,10 @@ add_executable(SetLang bar.c)
|
||||
set_source_files_properties(foo.c bar.c PROPERTIES LANGUAGE CXX)
|
||||
target_link_libraries(SetLang foo)
|
||||
set_target_properties(SetLang PROPERTIES LINKER_LANGUAGE CXX)
|
||||
|
||||
if((CMAKE_C_COMPILER_ID MATCHES "(GNU|Clang|MSVC|Borland|Embarcadero|Intel|TI|XL)"))
|
||||
add_library(zoom zoom.zzz)
|
||||
set_source_files_properties(zoom.zzz PROPERTIES LANGUAGE CXX)
|
||||
target_link_libraries(SetLang zoom)
|
||||
target_compile_definitions(SetLang PRIVATE WITH_ZOOM)
|
||||
endif()
|
||||
|
||||
+13
-1
@@ -1,10 +1,22 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int foo();
|
||||
|
||||
#ifdef WITH_ZOOM
|
||||
int zoom();
|
||||
#endif
|
||||
|
||||
class A
|
||||
{
|
||||
public:
|
||||
A() { this->i = foo(); }
|
||||
A()
|
||||
{
|
||||
this->i = foo();
|
||||
#ifdef WITH_ZOOM
|
||||
i += zoom();
|
||||
i -= zoom();
|
||||
#endif
|
||||
}
|
||||
int i;
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
int zoom()
|
||||
{
|
||||
int r = 10;
|
||||
r++;
|
||||
int ret = r + 10;
|
||||
return ret;
|
||||
}
|
||||
Reference in New Issue
Block a user