48 lines
1.9 KiB
CMake
48 lines
1.9 KiB
CMake
macro (PIP_EXTRACT_OPTIONS _pip_files _pip_options)
|
|
set(${_pip_files})
|
|
set(${_pip_options})
|
|
set(_PIP_DOING_OPTIONS FALSE)
|
|
foreach(_currentArg ${ARGN})
|
|
if("x${_currentArg}" STREQUAL "xOPTIONS")
|
|
set(_PIP_DOING_OPTIONS TRUE)
|
|
else()
|
|
if(_PIP_DOING_OPTIONS)
|
|
list(APPEND ${_pip_options} "${_currentArg}")
|
|
else()
|
|
list(APPEND ${_pip_files} "${_currentArg}")
|
|
endif()
|
|
endif ()
|
|
endforeach()
|
|
endmacro ()
|
|
|
|
macro (pip_code_model RESULT)
|
|
PIP_EXTRACT_OPTIONS(CCM_SRC OPTS ${ARGN})
|
|
set(CCM_OPTS)
|
|
foreach (it ${OPTS})
|
|
if(CCM_OPTS)
|
|
set(CCM_OPTS "${CCM_OPTS} ${it}")
|
|
else()
|
|
set(CCM_OPTS "${it}")
|
|
endif()
|
|
endforeach()
|
|
#message(STATUS "src = ${CCM_SRC}")
|
|
#message(STATUS "result = ${RESULT}")
|
|
#message(STATUS "options = ${CCM_OPTS}")
|
|
set(CCM_OUT ${CMAKE_CURRENT_BINARY_DIR}/ccm_${PROJECT_NAME}.cpp)
|
|
set(${RESULT} ${${RESULT}} ${CCM_OUT})
|
|
#message(STATUS "CCM = ${RESULT}")
|
|
add_custom_command(OUTPUT ${CCM_OUT}
|
|
COMMAND ${PIP_CMG}
|
|
ARGS -P ${CCM_OPTS} -o ${CMAKE_CURRENT_BINARY_DIR}/ccm_${PROJECT_NAME} -I${PIP_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR}/${CCM_SRC}
|
|
MAIN_DEPENDENCY ${CCM_SRC})
|
|
#VERBATIM)
|
|
#message(STATUS "Creating code model based on \"${CCM_SRC}\", please wait ... ")
|
|
#message(STATUS "exec \"-qP ${CCM_OPTS} -o ccm_${PROJECT_NAME} -I${PIP_INCLUDES} ${CCM_SRC}\"")
|
|
message(STATUS "Run CCM: ${PIP_CMG} -P ${CCM_OPTS} -o ${CMAKE_CURRENT_BINARY_DIR}/ccm_${PROJECT_NAME} -I${PIP_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR}/${CCM_SRC}")
|
|
#execute_process(OUTPUT_VARIABLE CMG_OUT COMMAND ${PIP_CMG} -qP ${CCM_OPTS} -o ${CMAKE_CURRENT_BINARY_DIR}/$ccm_{PROJECT_NAME} -I${PIP_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR}/${CCM_SRC})
|
|
#message(STATUS "Creating code model done, to use it include \"ccm_${PROJECT_NAME}.h\"")
|
|
#message(STATUS ${CMG_OUT})
|
|
#message(STATUS ${CACHE_CMG_FILES})
|
|
endmacro (pip_code_model)
|
|
|