larsch / cmake-precompiled-header

Visual Studio and GCC precompiled header macro for CMake
160 stars 42 forks source link

PrecompiledHeader.cmake: Fix setting SOURCE_CXX & SOURCE_C; recognize pch in subdirectories #6

Open andrzejc opened 7 years ago

andrzejc commented 7 years ago

cmake_parse_arguments() uses semicolon as separator, as it was SOURCE_C* options had no chance to work. if pch name includes subdirectory, prepend it to .cpp/.c file by default

larsch commented 7 years ago

Thanks for the update - but the tests don't pass with Visual Studio 2015 with these changes. I have applied the changes for SOURCE_CXX/SOURCE_C and make_directory() though.

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets(873,21): error MSB4198: The expression "DirectoryName" cannot be evaluated on item "test-c_c_pch/test-pch-$<CONFIG>.pch". Illegal characters in path. [C:\priv\cmake-precompiled-header\build\c-Visual Studio 14 2 015-build\test-c.vcxproj]

andrzejc commented 7 years ago

Hi Lars, I’ll check on this if time allows - I was hoping to use your code in 2 of my projects but the approach with setting source properties turned out to be unusable when there’re more then one target using the same set of source files - in my case these were the shared and static versions of the libraries. The same source file properties were being used for both targets resulting in erroneous build. Anyway, using "${CMAKE_CFG_INTDIR}” in make_directory causes the directory named literally $(ConfigurationName) to be created, that’s why I changed it. Strangely, I have not encountered the issue you described.

-Andrzej

On 15 Feb 2017, at 14:02, Lars Christensen notifications@github.com wrote:

Thanks for the update - but the tests don't pass with Visual Studio 2015 with these changes. I have applied the changes for SOURCE_CXX/SOURCE_C and make_directory() though.

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets(873,21): error MSB4198: The expression "DirectoryName" cannot be evaluated on item "test-c_c_pch/test-pch-$.pch". Illegal characters in path. [C:\priv\cmake-precompiled-header\build\c-Visual Studio 14 2 015-build\test-c.vcxproj]

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/larsch/cmake-precompiled-header/pull/6#issuecomment-280004803, or mute the thread https://github.com/notifications/unsubscribe-auth/ALb4KdqPSvi5a0_0OhEicdXtEwB0U5Coks5rcvdhgaJpZM4L-VHd.