Skip to content

Instantly share code, notes, and snippets.

@Zerophase
Created April 10, 2017 23:10
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Zerophase/6724b0073822667c08dcd4dee1ef3418 to your computer and use it in GitHub Desktop.
Save Zerophase/6724b0073822667c08dcd4dee1ef3418 to your computer and use it in GitHub Desktop.
example of precompiled header for clion
ADD_LIBRARY(PCH STATIC stdafx.cpp stdafx.h)
ADD_CUSTOM_COMMAND(TARGET PCH
PRE_BUILD
COMMAND ${CMAKE_CXX_COMMAND} -x c++-header ${CMAKE_CURRENT_SOURCE_DIR}/stdafx.h -o stdafx.h.pch)
SET_SOURCE_FILES_PROPERTIES(stdafx.cpp
PROPERTIES
COMPILE_FLAGS "-include stdafx.h")
//..
ADD_EXECUTABLE(ProjectFiles ${SOURCE_FILES})
TARGET_LINK_LIBRARIES(ProjectFiles PCH)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment