version 0.5.0_alpha
git-svn-id: svn://db.shs.com.ru/pip@8 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -7,7 +7,8 @@ else ()
|
||||
find_library(PIP_LIBRARY pip /usr/lib/)
|
||||
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
find_library(PTHREAD_LIBRARY pthread)
|
||||
list(APPEND PIP_LIBRARY ${PTHREAD_LIBRARY})
|
||||
find_library(DL_LIBRARY dl)
|
||||
list(APPEND PIP_LIBRARY ${PTHREAD_LIBRARY} ${DL_LIBRARY})
|
||||
endif ()
|
||||
set(PIP_INCLUDES /usr/include/pip)
|
||||
set(PIP_CMG /usr/bin/pip_cmg)
|
||||
@@ -29,9 +30,27 @@ if (PIP_FIND_VERSION VERSION_GREATER PIP_VERSION)
|
||||
endif ()
|
||||
|
||||
macro (pip_code_model SRC RESULT)
|
||||
set(RESULT "")
|
||||
set(OPTIONS "")
|
||||
set(_IS_OPT false)
|
||||
foreach (_A ${ARGN})
|
||||
#message(STATUS ${_A})
|
||||
if (_IS_OPT)
|
||||
set (OPTIONS ${_A})
|
||||
else ()
|
||||
if ("${_A}" STREQUAL "OPTIONS")
|
||||
set(_IS_OPT true)
|
||||
else ()
|
||||
set (RESULT ${_A})
|
||||
endif ()
|
||||
endif ()
|
||||
endforeach()
|
||||
#message(STATUS "src = ${SRC}")
|
||||
#message(STATUS "result = ${RESULT}")
|
||||
#message(STATUS "options = ${OPTIONS}")
|
||||
set(NEED_PARSE FALSE CACHE BOOL "NEED_PARSE" FORCE)
|
||||
if (DEFINED CACHE_CMG_FILES)
|
||||
string(REPLACE " " ";" CMG_LIST_C ${CACHE_CMG_FILES})
|
||||
string(REPLACE " " ";" CMG_LIST_C "${CACHE_CMG_FILES}")
|
||||
foreach (CF ${CMG_LIST_C})
|
||||
file (TIMESTAMP ${CF} ATIME)
|
||||
if (NOT TIME_${CF} STREQUAL ATIME)
|
||||
@@ -47,10 +66,11 @@ macro (pip_code_model SRC RESULT)
|
||||
endif ()
|
||||
if (NEED_PARSE)
|
||||
message(STATUS "Creating code model based on \"${SRC}\", please wait ... ")
|
||||
execute_process(COMMAND ${PIP_CMG} -qP -o ${PROJECT_NAME}_ccm -I${PIP_INCLUDES} ${SRC} OUTPUT_VARIABLE CMG_OUT)
|
||||
#message(STATUS "exec \"-qP ${OPTIONS} -o ${PROJECT_NAME}_ccm -I${PIP_INCLUDES} ${SRC}\"")
|
||||
execute_process(COMMAND ${PIP_CMG} -qP ${OPTIONS} -o ${PROJECT_NAME}_ccm -I${PIP_INCLUDES} ${SRC} OUTPUT_VARIABLE CMG_OUT)
|
||||
message(STATUS "Creating code model done, to use it include \"${PROJECT_NAME}_ccm.h\"")
|
||||
string(REPLACE "\n" ";" CMG_LIST ${CMG_OUT})
|
||||
string(REPLACE "\n" " " CMG_LIST_S ${CMG_OUT})
|
||||
string(REPLACE "\n" ";" CMG_LIST "${CMG_OUT}")
|
||||
string(REPLACE "\n" " " CMG_LIST_S "${CMG_OUT}")
|
||||
set(CACHE_CMG_FILES ${CMG_LIST_S} CACHE INTERNAL "CACHE_CMG_FILES" FORCE)
|
||||
foreach (CF ${CMG_LIST})
|
||||
file (TIMESTAMP ${CF} ATIME)
|
||||
|
||||
Reference in New Issue
Block a user