Skip to content

Instantly share code, notes, and snippets.

View SaurabhSangpal's full-sized avatar
🔨

Saurabh Sangpal SaurabhSangpal

🔨
View GitHub Profile
@SaurabhSangpal
SaurabhSangpal / CMakeLists.txt
Created October 27, 2019 15:47
Copy dll to binary folder
ADD_CUSTOM_COMMAND(TARGET PROJECT_NAME POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"${DLL_FILE}" $<TARGET_FILE_DIR:PROJECT_NAME>)
# Note that this must be run after a target has been created, i.e., after running add_executable
@SaurabhSangpal
SaurabhSangpal / CMakeLists.txt
Last active January 5, 2020 06:39
CMake Precompiled Header for Windows
#Based on an answer on StackOverflow https://stackoverflow.com/a/1380048
MACRO(ADD_MSVC_PRECOMPILED_HEADER PrecompiledHeader PrecompiledSource SourcesVar)
IF(MSVC)
GET_FILENAME_COMPONENT(PrecompiledBasename ${PrecompiledHeader} NAME_WE)
SET(PrecompiledBinary "${CMAKE_CURRENT_BINARY_DIR}/${PrecompiledBasename}.pch")
SET(Sources ${${SourcesVar}})
SET_SOURCE_FILES_PROPERTIES(${PrecompiledSource}
PROPERTIES COMPILE_FLAGS "/Yc\"${PrecompiledHeader}\" /Fp\"${PrecompiledBinary}\""