git-svn-id: svn://db.shs.com.ru/pip@287 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2016-11-30 14:19:55 +00:00
parent d882cc1a69
commit e92b070851
2 changed files with 36 additions and 1 deletions

View File

@@ -30,5 +30,5 @@ if (PIP_FIND_VERSION VERSION_GREATER PIP_VERSION)
message(FATAL_ERROR "PIP version ${PIP_VERSION} is available, but ${PIP_FIND_VERSION} requested!")
endif ()
include(PIPMacros.cmake)
include(${CMAKE_ROOT}/Modules/PIPMacros2.cmake)

35
PIPMacros2.cmake Normal file
View File

@@ -0,0 +1,35 @@
macro (pip_code_model SRC RESULT)
set(RESULT "")
set(OPTS "")
set(_IS_OPT false)
foreach (_A ${ARGN})
#message(STATUS ${_A})
if (_IS_OPT)
list (APPEND OPTS ${_A})
else ()
if ("${_A}" STREQUAL "OPTIONS")
set(_IS_OPT true)
else ()
set (RESULT ${_A})
endif ()
endif ()
endforeach()
#message(STATUS "src = ${CMAKE_CURRENT_SOURCE_DIR}/${SRC}")
#message(STATUS "result = ${RESULT}")
#message(STATUS "options = ${OPTS}")
set(${RESULT} ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_ccm.cpp)
#message(STATUS "Res = ${${RESULT}}")
add_custom_command(OUTPUT ${RESULT}
COMMAND ${PIP_CMG} -qP ${OPTS} -o ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_ccm -I${PIP_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR}/${SRC}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${SRC}
VERBATIM)
#message(STATUS "Creating code model based on \"${SRC}\", please wait ... ")
#message(STATUS "exec \"-qP ${OPTS} -o ${PROJECT_NAME}_ccm -I${PIP_INCLUDES} ${SRC}\"")
#message(STATUS "exec ${PIP_CMG} -P ${OPTS} -o ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_ccm -I${PIP_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR}/${SRC}")
#execute_process(OUTPUT_VARIABLE CMG_OUT COMMAND ${PIP_CMG} -qP ${OPTS} -o ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_ccm -I${PIP_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR}/${SRC})
#message(STATUS "Creating code model done, to use it include \"${PROJECT_NAME}_ccm.h\"")
#message(STATUS ${CMG_OUT})
#message(STATUS ${CACHE_CMG_FILES})
endmacro (pip_code_model)