1
2
3
4
5
6
7
8
9
10
11
12
function(use_library)
foreach(name ${ARGN})
if(${name} STREQUAL ".")
include_directories(${PROJECT_SOURCE_DIR}/include)
link_directories(${PROJECT_SOURCE_DIR}/lib)
else()
message(${PROJECT_SOURCE_DIR}/3rdparty/${name}/include)
include_directories(${PROJECT_SOURCE_DIR}/3rdparty/${name}/include)
link_directories(${PROJECT_SOURCE_DIR}/3rdparty/${name}/lib)
endif()
endforeach()
endfunction()

参考

  1. http://www.cmake.org/cmake/help/v3.0/command/foreach.html

留言