Hi everyone, i have the following code:
nclude(CMakePrintHelpers)
## MACROS
###########################################################
macro(bsIsInListBefore)
message(STATUS "bsIsInListBefore(): #${ARGV0}#${ARGV1}")
set(index1 0)
set(index2 0)
cmake_print_variables(ARG1)
list(FIND ${LIBS_TO_BUILD} ${ARGV1} index1)
cmake_print_variables(index1)
if(index1 GREATER -1)
list(FIND ${LIBS_TO_BUILD} ${ARG2} index2)
message(STATUS "index found")
elseif()
message(STATUS "index NO found")
endif()
endmacro()
set(LIBS_TO_BUILD
glad
glfw
eigen
cppflags
python
boost
)
## Main ############################################################
cmake_print_variables(LIBS_TO_BUILD)
bsIsInListBefore(${LIBS_TO_BUILD} glfw glad is_before)
if(${is_before})
message(STATUS "-------> glfw in in front of glad")
endif()
message(STATUS "YES glfw is before glad in the list !!!!")
I've never use list(FIND and i never knoe if i should pass a variable
with %{VAR} or VAR only..
best regards,
Steven Truppe
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake