mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +00:00
[CMAKE]
- Fix precompiled header support (the pch cleanup phase). - Improve its use in crt. svn path=/branches/cmake-bringup/; revision=48452
This commit is contained in:
parent
ce238e95a4
commit
ba7d98adba
2 changed files with 28 additions and 30 deletions
|
@ -1,40 +1,40 @@
|
|||
|
||||
MACRO(_PCH_GET_COMPILE_FLAGS _target_name _out_compile_flags _header_filename)
|
||||
|
||||
# Add the precompiled header to the build
|
||||
SET(_gch_filename "${_header_filename}.gch")
|
||||
LIST(APPEND ${_out_compile_flags} -c ${_header_filename} -o ${_gch_filename})
|
||||
# Add the precompiled header to the build
|
||||
set(_gch_filename "${_header_filename}.gch")
|
||||
list(APPEND ${_out_compile_flags} -c ${_header_filename} -o ${_gch_filename})
|
||||
|
||||
# This gets us our includes
|
||||
GET_DIRECTORY_PROPERTY(DIRINC INCLUDE_DIRECTORIES)
|
||||
FOREACH(item ${DIRINC})
|
||||
LIST(APPEND ${_out_compile_flags} -I${item})
|
||||
ENDFOREACH(item)
|
||||
# This gets us our includes
|
||||
get_directory_property(DIRINC INCLUDE_DIRECTORIES)
|
||||
foreach(item ${DIRINC})
|
||||
list(APPEND ${_out_compile_flags} -I${item})
|
||||
endforeach(item)
|
||||
|
||||
# This is a particular bit of undocumented/hacky magic I'm quite proud of
|
||||
GET_DIRECTORY_PROPERTY(_compiler_flags DEFINITIONS)
|
||||
STRING(REPLACE "\ " "\t" _compiler_flags ${_compiler_flags})
|
||||
LIST(APPEND ${_out_compile_flags} ${_compiler_flags})
|
||||
# This is a particular bit of undocumented/hacky magic I'm quite proud of
|
||||
get_directory_property(_compiler_flags DEFINITIONS)
|
||||
STRING(REPLACE "\ " "\t" _compiler_flags ${_compiler_flags})
|
||||
list(APPEND ${_out_compile_flags} ${_compiler_flags})
|
||||
|
||||
# This gets any specific definitions that were added with set-target-property
|
||||
GET_TARGET_PROPERTY(_target_defs ${_target_name} COMPILE_DEFINITIONS)
|
||||
IF (_target_defs)
|
||||
FOREACH(item ${_target_defs})
|
||||
LIST(APPEND ${_out_compile_flags} -D${item})
|
||||
ENDFOREACH(item)
|
||||
ENDIF()
|
||||
# This gets any specific definitions that were added with set-target-property
|
||||
GET_TARGET_PROPERTY(_target_defs ${_target_name} COMPILE_DEFINITIONS)
|
||||
if (_target_defs)
|
||||
foreach(item ${_target_defs})
|
||||
list(APPEND ${_out_compile_flags} -D${item})
|
||||
endforeach(item)
|
||||
endif()
|
||||
|
||||
ENDMACRO(_PCH_GET_COMPILE_FLAGS)
|
||||
|
||||
MACRO(add_pch _target_name _header_filename _src_list)
|
||||
|
||||
SET(_gch_filename "${_header_filename}.gch")
|
||||
set(_gch_filename "${_header_filename}.gch")
|
||||
list(APPEND ${_src_list} ${_gch_filename})
|
||||
_PCH_GET_COMPILE_FLAGS(${_target_name} _args ${_header_filename})
|
||||
file(REMOVE ${_gch_filename})
|
||||
add_custom_command(
|
||||
OUTPUT ${_gch_filename}
|
||||
COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1} ${_args}
|
||||
DEPENDS ${_header_filename})
|
||||
|
||||
LIST(APPEND ${_src_list} ${_gch_filename})
|
||||
|
||||
_PCH_GET_COMPILE_FLAGS(${_target_name} _args ${_header_filename})
|
||||
|
||||
add_custom_command(OUTPUT ${_gch_filename}
|
||||
COMMAND rm -f ${_gch_filename}
|
||||
COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1} ${_args}
|
||||
DEPENDS ${_header_filename})
|
||||
ENDMACRO(add_pch _target_name _header_filename _src_list)
|
||||
|
|
|
@ -6,8 +6,6 @@ file(GLOB_RECURSE CRT_SOURCE "*.c")
|
|||
LIST(REMOVE_ITEM CRT_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/stdio/findgen.c)
|
||||
LIST(REMOVE_ITEM CRT_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/string/strtold.c)
|
||||
|
||||
SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/precomp.h.gch PROPERTIES GENERATED ON)
|
||||
|
||||
add_library(crt ${CRT_SOURCE} ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h.gch)
|
||||
set_property(TARGET crt PROPERTY COMPILE_DEFINITIONS __MINGW_IMPORT=extern USE_MSVCRT_PREFIX _MSVCRT_LIB_ _MSVCRT_ _MT)
|
||||
add_pch(crt ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h ${CRT_SOURCE})
|
||||
|
|
Loading…
Reference in a new issue