mirror of
https://github.com/reactos/CMake.git
synced 2024-12-02 00:26:18 +00:00
Fix vs2010 project generation error when HEADER_FILE_ONLY is set.
In vs2010 a bad project file could be generated if a .c or .cxx file was marked with HEADER_FILE_ONLY, if it was in a library that contained both c and c++ code. This fixes the error in the code, and adds a test for this case.
This commit is contained in:
parent
34a2dee75d
commit
f578381e66
@ -700,7 +700,7 @@ void cmVisualStudio10TargetGenerator::WriteCLSources()
|
||||
}
|
||||
(*this->BuildFileStream ) << sourceFile << "\"";
|
||||
// ouput any flags specific to this source file
|
||||
if(cl && this->OutputSourceSpecificFlags(*source))
|
||||
if(!header && cl && this->OutputSourceSpecificFlags(*source))
|
||||
{
|
||||
// if the source file has specific flags the tag
|
||||
// is ended on a new line
|
||||
|
@ -49,10 +49,17 @@ LINK_LIBRARIES(${COMPLEX_LIBS})
|
||||
SET_SOURCE_FILES_PROPERTIES(complex_nobuild.cxx PROPERTIES
|
||||
HEADER_FILE_ONLY 1)
|
||||
|
||||
# Test forcing a .c file to not build.
|
||||
# This makes sure a mixed language library is created
|
||||
# with header file only sources
|
||||
SET_SOURCE_FILES_PROPERTIES(complex_nobuild.c PROPERTIES
|
||||
HEADER_FILE_ONLY 1)
|
||||
|
||||
ADD_EXECUTABLE(A A.cxx A.hh A.h A.txt)
|
||||
ADD_EXECUTABLE(complex complex testcflags.c )
|
||||
# Sub1/NameConflictTest.c Sub2/NameConflictTest.c)
|
||||
ADD_EXECUTABLE(complex.file complex.file.cxx complex_nobuild.cxx)
|
||||
ADD_EXECUTABLE(complex.file complex.file.cxx complex_nobuild.cxx
|
||||
complex_nobuild.c)
|
||||
IF(COMPLEX_TEST_CMAKELIB)
|
||||
TARGET_LINK_LIBRARIES(complex CMakeLib cmsys cmexpat cmzlib cmlibarchive cmbzip2 cmcurl)
|
||||
ENDIF(COMPLEX_TEST_CMAKELIB)
|
||||
|
1
Tests/Complex/Executable/complex_nobuild.c
Normal file
1
Tests/Complex/Executable/complex_nobuild.c
Normal file
@ -0,0 +1 @@
|
||||
#error "This file should not be compiled."
|
Loading…
Reference in New Issue
Block a user