diff --git a/FindPIP.cmake b/FindPIP.cmake index dd2d711a..9f572264 100644 --- a/FindPIP.cmake +++ b/FindPIP.cmake @@ -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) diff --git a/PIPMacros2.cmake b/PIPMacros2.cmake new file mode 100644 index 00000000..dde6d934 --- /dev/null +++ b/PIPMacros2.cmake @@ -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) +