


SET(TOP_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
#MESSAGE(STATUS "TOP_BINARY_DIR: ${TOP_BINARY_DIR}")

SET( ${PROJECT_NAME}_USE_CONFIG_H TRUE CACHE BOOL "$(PROJECT) project use config.h instead of compiler switch -Defines." )
MARK_AS_ADVANCED(${PROJECT_NAME}_USE_CONFIG_H)

SET(${PROJECT_NAME}_CONFIG_FILES)

#	add_definitions(-DBOOST_USER_CONFIG="<config.h>")
#	configure_file(${P_CONFIG_INCLUDE_PATH}/pcheaders.h      ${TOP_BINARY_DIR}/pcheaders.h)
#	configure_file(${P_CONFIG_INCLUDE_PATH}/config.cpp.cmake ${TOP_BINARY_DIR}/config_pch.cpp)
#   LIST(APPEND ${PROJECT_NAME}_CONFIG_FILES ${TOP_BINARY_DIR}/pcheaders.h)
#   LIST(APPEND ${PROJECT_NAME}_CONFIG_FILES ${TOP_BINARY_DIR}/config_pch.cpp)
#	add_definitions(-DLYX_ENABLE_PCH)

IF(MSVC AND NOT LYX_CONFIGURE_CHECKS)
	CONFIGURE_FILE(${P_CONFIG_INCLUDE_PATH}/configCompiler.h.msvc ${TOP_BINARY_DIR}/configCompiler.h)
    LIST(APPEND ${PROJECT_NAME}_CONFIG_FILES ${TOP_BINARY_DIR}/configCompiler.h)
ELSE()
	INCLUDE(${P_CONFIG_INCLUDE_PATH}/ConfigureChecks.cmake)
	CONFIGURE_FILE(${P_CONFIG_INCLUDE_PATH}/configCompiler.h.cmake ${TOP_BINARY_DIR}/configCompiler.h)
    LIST(APPEND ${PROJECT_NAME}_CONFIG_FILES ${TOP_BINARY_DIR}/configCompiler.h)
ENDIF()

CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${TOP_BINARY_DIR}/config.h)
LIST(APPEND ${PROJECT_NAME}_CONFIG_FILES ${TOP_BINARY_DIR}/config.h)
SOURCE_GROUP(GlobalHeader FILES ${${PROJECT_NAME}_CONFIG_FILES})

IF(${${PROJECT_NAME}_USE_CONFIG_H})
	ADD_DEFINITIONS(-DHAVE_CONFIG_H)
	ADD_DEFINITIONS(-DHAVE_${PROJECT_NAME}_CONFIG_H)
ENDIF(${${PROJECT_NAME}_USE_CONFIG_H})

#Implement Install for the config files
