Changed: #880 Added WITH_PCH to activate Precompiled Header (default is ON)

This commit is contained in:
kervala 2010-06-26 17:14:08 +02:00
parent 0238458539
commit f33365ea10
5 changed files with 89 additions and 84 deletions

View file

@ -159,6 +159,7 @@ ENDMACRO(ADD_PRECOMPILED_HEADER_TO_TARGET)
MACRO(ADD_PRECOMPILED_HEADER _targetName _inputh _inputcpp) MACRO(ADD_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
IF(WITH_PCH)
SET(_PCH_current_target ${_targetName}) SET(_PCH_current_target ${_targetName})
IF(NOT CMAKE_BUILD_TYPE) IF(NOT CMAKE_BUILD_TYPE)
@ -211,10 +212,13 @@ MACRO(ADD_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
) )
ADD_PRECOMPILED_HEADER_TO_TARGET(${_targetName} ${_inputh} ${_output} ${_dowarn}) ADD_PRECOMPILED_HEADER_TO_TARGET(${_targetName} ${_inputh} ${_output} ${_dowarn})
ENDIF(WITH_PCH)
ENDMACRO(ADD_PRECOMPILED_HEADER) ENDMACRO(ADD_PRECOMPILED_HEADER)
MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp) MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
IF(WITH_PCH)
IF( "${ARGN}" STREQUAL "0") IF( "${ARGN}" STREQUAL "0")
SET(_dowarn 0) SET(_dowarn 0)
ELSE( "${ARGN}" STREQUAL "0") ELSE( "${ARGN}" STREQUAL "0")
@ -261,5 +265,6 @@ MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
ADD_PRECOMPILED_HEADER(${_targetName} ${_inputh} ${_inputcpp} ${_dowarn}) ADD_PRECOMPILED_HEADER(${_targetName} ${_inputh} ${_inputcpp} ${_dowarn})
endif(CMAKE_GENERATOR MATCHES Xcode) endif(CMAKE_GENERATOR MATCHES Xcode)
endif(CMAKE_GENERATOR MATCHES Visual*) endif(CMAKE_GENERATOR MATCHES Visual*)
ENDIF(WITH_PCH)
ENDMACRO(ADD_NATIVE_PRECOMPILED_HEADER) ENDMACRO(ADD_NATIVE_PRECOMPILED_HEADER)

View file

@ -47,6 +47,7 @@ MACRO(NL_SETUP_DEFAULT_OPTIONS)
### ###
OPTION(WITH_LOGGING "With Logging" ON ) OPTION(WITH_LOGGING "With Logging" ON )
OPTION(WITH_COVERAGE "With Code Coverage Support" OFF) OPTION(WITH_COVERAGE "With Code Coverage Support" OFF)
OPTION(WITH_PCH "With Precompiled Headers" ON )
### ###
# Core libraries # Core libraries

View file

@ -16,13 +16,13 @@ TARGET_LINK_LIBRARIES( object_viewer
object_viewer_dll) object_viewer_dll)
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) ADD_DEFINITIONS(${LIBXML2_DEFINITIONS})
SET_TARGET_PROPERTIES(object_viewer PROPERTIES COMPILE_FLAGS "/Yustd_afx.h")
SET_SOURCE_FILES_PROPERTIES(std_afx.cpp PROPERTIES COMPILE_FLAGS "/Ycstd_afx.h")
SET_TARGET_PROPERTIES(object_viewer PROPERTIES SET_TARGET_PROPERTIES(object_viewer PROPERTIES
LINK_FLAGS_DEBUG "${CMAKE_LINK_FLAGS_DEBUG}" LINK_FLAGS_DEBUG "${CMAKE_LINK_FLAGS_DEBUG}"
LINK_FLAGS_RELEASE "${CMAKE_LINK_FLAGS_RELEASE}" LINK_FLAGS_RELEASE "${CMAKE_LINK_FLAGS_RELEASE}"
PROJECT_LABEL "Tools, 3D: Object Viewer") PROJECT_LABEL "Tools, 3D: Object Viewer")
ADD_NATIVE_PRECOMPILED_HEADER(object_viewer ${CMAKE_CURRENT_SOURCE_DIR}/std_afx.h ${CMAKE_CURRENT_SOURCE_DIR}/std_afx.cpp)
INSTALL(TARGETS object_viewer RUNTIME DESTINATION bin COMPONENT tools3d) INSTALL(TARGETS object_viewer RUNTIME DESTINATION bin COMPONENT tools3d)
IF(WITH_MAXPLUGIN) IF(WITH_MAXPLUGIN)
INSTALL(TARGETS object_viewer RUNTIME DESTINATION maxplugin COMPONENT tools3d) INSTALL(TARGETS object_viewer RUNTIME DESTINATION maxplugin COMPONENT tools3d)

View file

@ -16,15 +16,14 @@ SET_TARGET_PROPERTIES(logic_editor_dll PROPERTIES
PROJECT_LABEL "Tools, Logic: Logic Editor DLL") PROJECT_LABEL "Tools, Logic: Logic Editor DLL")
IF(WIN32) IF(WIN32)
SET_TARGET_PROPERTIES(logic_editor_dll PROPERTIES COMPILE_FLAGS "/YuStdAfx.h")
SET_SOURCE_FILES_PROPERTIES(StdAfx.cpp PROPERTIES COMPILE_FLAGS "/YcStdAfx.h")
SET_TARGET_PROPERTIES(logic_editor_dll PROPERTIES SET_TARGET_PROPERTIES(logic_editor_dll PROPERTIES
LINK_FLAGS_DEBUG "${CMAKE_LINK_FLAGS_DEBUG}" LINK_FLAGS_DEBUG "${CMAKE_LINK_FLAGS_DEBUG}"
LINK_FLAGS_RELEASE "${CMAKE_LINK_FLAGS_RELEASE}" LINK_FLAGS_RELEASE "${CMAKE_LINK_FLAGS_RELEASE}"
) )
ENDIF(WIN32) ENDIF(WIN32)
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) ADD_DEFINITIONS(${LIBXML2_DEFINITIONS})
ADD_NATIVE_PRECOMPILED_HEADER(logic_editor_dll ${CMAKE_CURRENT_SOURCE_DIR}/StdAfx.h ${CMAKE_CURRENT_SOURCE_DIR}/StdAfx.cpp)
INSTALL(TARGETS logic_editor_dll LIBRARY DESTINATION lib RUNTIME DESTINATION bin ARCHIVE DESTINATION lib COMPONENT toolsmisc) INSTALL(TARGETS logic_editor_dll LIBRARY DESTINATION lib RUNTIME DESTINATION bin ARCHIVE DESTINATION lib COMPONENT toolsmisc)

View file

@ -7,12 +7,12 @@ TARGET_LINK_LIBRARIES(logic_editor ${LIBXML2_LIBRARIES} ${PLATFORM_LINKFLAGS} ne
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) ADD_DEFINITIONS(${LIBXML2_DEFINITIONS})
IF(WIN32) IF(WIN32)
SET_TARGET_PROPERTIES(logic_editor PROPERTIES COMPILE_FLAGS "/YuStdAfx.h")
SET_SOURCE_FILES_PROPERTIES(StdAfx.cpp PROPERTIES COMPILE_FLAGS "/YcStdAfx.h")
SET_TARGET_PROPERTIES(logic_editor PROPERTIES SET_TARGET_PROPERTIES(logic_editor PROPERTIES
LINK_FLAGS_DEBUG "${CMAKE_LINK_FLAGS_DEBUG}" LINK_FLAGS_DEBUG "${CMAKE_LINK_FLAGS_DEBUG}"
LINK_FLAGS_RELEASE "${CMAKE_LINK_FLAGS_RELEASE}" LINK_FLAGS_RELEASE "${CMAKE_LINK_FLAGS_RELEASE}"
PROJECT_LABEL "Tools, Logic: Logic Editor") PROJECT_LABEL "Tools, Logic: Logic Editor")
ENDIF(WIN32) ENDIF(WIN32)
ADD_NATIVE_PRECOMPILED_HEADER(logic_editor ${CMAKE_CURRENT_SOURCE_DIR}/StdAfx.h ${CMAKE_CURRENT_SOURCE_DIR}/StdAfx.cpp)
INSTALL(TARGETS logic_editor RUNTIME DESTINATION bin COMPONENT toolsmisc) INSTALL(TARGETS logic_editor RUNTIME DESTINATION bin COMPONENT toolsmisc)