Files
pip/PIPMacros.cmake

42 lines
1.3 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})
#message(STATUS "src = ${CCM_SRC}")
#message(STATUS "result = ${RESULT}")
#message(STATUS "options = \"${CCM_OPTS}\"")
set(CMG_INCLUDES)
foreach(pi ${PIP_INCLUDES})
list(APPEND CMG_INCLUDES "-I${pi}")
endforeach()
set(CCM_OUT ${CMAKE_CURRENT_BINARY_DIR}/ccm_${PROJECT_NAME}.cpp)
set(${RESULT} ${${RESULT}} ${CCM_OUT})
#message(STATUS "CCM = ${RESULT}")
if(NOT DEFINED PIP_DLL_DIR)
set(PIP_DLL_DIR ${CMAKE_CURRENT_BINARY_DIR})
endif()
add_custom_command(OUTPUT ${CCM_OUT}
COMMAND ${PIP_CMG}
ARGS -q ${OPTS} -o ${CMAKE_CURRENT_BINARY_DIR}/ccm_${PROJECT_NAME} ${CMG_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR}/${CCM_SRC}
DEPENDS ${CCM_SRC}
WORKING_DIRECTORY ${PIP_DLL_DIR}
COMMENT "Generating ccm_${PROJECT_NAME}.h, ccm_${PROJECT_NAME}.cpp"
VERBATIM)
endmacro()