[CMake] Problems with ExternalProject_Add
Hi everyone, i'm trying to use ExternalProject_Add like the following: set(BOOST_VERSION 1.68.0) set(BOOST_VERSION_NODOTS 1_68_0) set(BOOST_URI https://dl.bintray.com/boostorg/release/${BOOST_VERSION}/source/boost_${BOOST_VERSION_NODOTS}.tar.gz) set(BOOST_HASH 5d8b4503582fffa9eefdb9045359c239) ExternalProject_Add(external_boost PREFIX ${CMAKE_BINARY_DIR}/boost URL ${BOOST_URL} DOWNLOAD_DIR ${CMAKE_BINARY_DIR}/boost URL_HASH MD5=${BOOST_HASH} CONFIGURE_COMMAND cd ${CMAKE_BINARY_DIR}/boost/src/external_boost/ && ./bootstrab --prefix=${OUTPUT_PATH}/boost BUILD_COMMAND cd ${CMAKE_BINARY_DIR}/boost/src/external_boost/ && ./b2 BUILD_IN_SOURCE 1 INSTALL_DIR ${OUTPUT_PATH}/boost The problem is that he tells me that the md5 sum isn't correct, but i did md5sum ${BOOST_URL}. I now play around with this for nearnly an hour and i allways get the same error. I hope someone here can help me out. 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
[CMake] Troubles with booost and ExternalLibraries_Add
Hi everyone, i'm trying to get the boost library working with cmake and externalproject_add: https://paste.debian.net/1082645/ best regards! -- 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
[CMake] Troubles compiling llvm
Hi everyone, i'm trying to compile llvm with ExternalProject_Add and get the following error: -- Installing: /usr/lib/ocaml/llvm/llvm.mli CMake Error at bindings/ocaml/llvm/cmake_install.cmake:49 (file): file INSTALL cannot copy file "/home/stuv/linux-projects/programming/bsEdit/build_files/Release/llvm/src/external_llvm-build/bindings/ocaml/llvm/llvm.mli" to "/usr/lib/ocaml/llvm/llvm.mli". Call Stack (most recent call first): bindings/ocaml/cmake_install.cmake:42 (include) cmake_install.cmake:64 (include) Makefile:128: die Regel für Ziel „install“ scheiterte make[3]: *** [install] Fehler 1 CMakeFiles/external_llvm.dir/build.make:73: die Regel für Ziel „../build_files/Release/llvm/src/external_llvm-stamp/external_llvm-install“ scheiterte make[2]: *** [../build_files/Release/llvm/src/external_llvm-stamp/external_llvm-install] Fehler 2 CMakeFiles/Makefile2:72: die Regel für Ziel „CMakeFiles/external_llvm.dir/all“ scheiterte make[1]: *** [CMakeFiles/external_llvm.dir/all] Fehler 2 Makefile:83: die Regel für Ziel „all“ scheiterte make: *** [all] Fehler 2 set(LLVM_EXTRA_ARGS -DLLVM_USE_CRT_RELEASE=MT -DLLVM_USE_CRT_DEBUG=MTd -DLLVM_INCLUDE_TESTS=OFF -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_ENABLE_TERMINFO=OFF -DLLVM_BUILD_EXAMPLES=ON ) set(LLVM_GENERATOR "Unix Makefiles") ExternalProject_Add(external_llvm URL ${LLVM_URL} DOWNLOAD_DIR download/llvm URL_HASH MD5=${LLVM_HASH} CMAKE_GENERATOR ${LLVM_GENERATOR} PREFIX ${OUTPUT_PATH}/llvm CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${OUTPUT_PATH}/llvm ${DEFAULT_CMAKE_FLAGS} ${LLVM_EXTRA_ARGS} INSTALL_DIR ${OUTPUT_PATH}/llvm ) I followed the instructions from llvm.org but i still get this error during installation (the build process works fine but during install i get this error). best regards! -- 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
[CMake] Questin about ExternalProject_Add
Hi everyone, i'm trying to create a build system that download all needed libraries with ExternalProject_Add. i've the following lines in my CMakeLists.txt: option(WITH_LIB_GLFW "Support for the GLFW library. (default: 1)" 1) option(WITH_LIB_NLOHMANN_JSON "Support for the nlohmann JSON library. (default: 1)" 1) option(WITH_LIB_ZLIB "Support for the zlib library. (default: 1)" 1) option(WITH_LIB_ZLMA "Support for the zlma library. (default: 1)" 1) option(WITH_LIB_FLEX "Support for the flex library. (default: 1)" 1) option(WITH_LIB_OPENSSL "Support for the OpenSSL library. (default: 1)" 1) option(WITH_LIB_BZIP2 "Support for the bzip2 library. (default: 1)" 1) option(WITH_LIB_FREETYPE "Support for the freetype library (default: 1)" 1) option(WITH_LIB_STB_IMAGE "Support for JPG, PNG, TGA, BMP, PSD, GIF, HDR, PIC" 1) option(WITH_LIB_STB_IMAGE_WRITE "Support to write PNG, TGA and BMP" 1) option(WITH_LIB_PYTHON "Support for Python embeding" 1) option(WITH_LIB_BOOST "Support for the boost C++ library" 1) and later in that file i have: IF(WITH_LIB_GLFW) message(STATUS "WITH_LIB_GLAD") include(glad_def) include(glad_deps) message(STATUS "WITH_LIB_GLFW") include(glfw_def) include(glfw_deps) ENDIF() IF(WITH_LIB_NLOHMANN_JSON) message(STATUS "WITH_LIB_NLOHMANN_JSON") include(nlohmann_json_def) include(nlohmann_json_deps) ENDIF() IF(WITH_LIB_STB_IMAGE) message(STATUS "WITH_LIB_STB_IMAGE") include(stb_image_deps) ENDIF() IF(WITH_LIB_STB_IMAGE_WRITE) message(STATUS "WITH_LIB_STB_IMAGE_WRITE") include(stb_image_write_deps) ENDIF() IF(WITH_LIB_FTGL) message(STATUS "WITH_LIB_FTGL") # include(ftgl_defs) include(ftgl_deps) ENDIF() IF(WITH_LIB_ZLIB) message(STATUS "WITH_LIB_ZLIB") include(zlib_deps) ENDIF() IF(WITH_LIB_FLEX) message(STATUS "WITH_LIB_FLEX") include(flex_deps) ENDIF() IF(WITH_LIB_BISON) message(STATUS "WITH_LIB_BISON") include(bison_deps) ENDIF() IF(WITH_LIB_BZIP2) message(STATUS "WITH_LIB_BZIP2") include(bzip2_deps) ENDIF() IF(WITH_LIB_ZLMA) message(STATUS "WITH_LIB_ZLMA") include(zlma_deps) ENDIF() IF(WITH_LIB_OPENSSL) message(STATUS "WITH_LIB_OPENSSL") include(openssl_deps) ENDIF() IF(WITH_LIB_GETTEXT) message(STATUS "WITH_LIB_GETTEXT") include(gettext_deps) ENDIF() IF(WITH_LIB_FREETYPE) message(STATUS "WITH_LIB_FREETYPE") include(freetype_deps) ENDIF() IF(WITH_LIB_PYTHON) message(STATUS "WITH_LIB_PYTHON") include(python_defs) include(python_deps) ENDIF() IF(WITH_LIB_BOOST) message(STATUS "WITH_LIB_BOOST") include(boost_deps) ENDIF() The strange thing is that he does not does it in the right order - he start's with WITH_LIB_BOOST instead of WITH_LIB_GLFW. What am i doing wrong here ?? best regards! -- 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
[CMake] Question about IF and STRINGS
Hi everyone, i try to create a build system where you can decide which libraries you want to use with variables like "WITH_LIB_GLFW" for example. every lib variable has other variables like WITH_LIB_GLFW_INC_PATH, WITH_LIB_GLFW_LIB_PATH, etc. so i can decide with cmake what libraries i'm going to use for the final executable. Now my problem is that i'm relative new to cmake and i'm learning c++11 in the meantime and are coding on a project so i don't have to much time for cmake (but it's a realy important part). Here is the code: cmake_minimum_required(VERSION 3.14 FATAL_ERROR) include(CMakePrintHelpers) set(WITH_LIB_GLAD "Support the GLAD library" 1) set(WITH_LIB_GLFW "Support for the GLFW library" 1) macro(bsAddLibrary lib) # get all WITH_LIB varables get_cmake_property(_variables VARIABLES) foreach(_var ${_variables}) # cmake_print_variables(${_var}) if(${_var} MATCHES "^WITH_LIB_[AZaz]+$" _lib) cmake_print_variables(${_lib}) endif() endforeach() endmacro() bsAddLibrary(WITH_LIB_GLAD) # Adds WITH_LIB_GLAD_INC_PATH and the other variables to a list for the main application that holds all inc path, compiler flags etc. ERROR: == -- The C compiler identification is GNU 6.3.0 -- The CXX compiler identification is GNU 6.3.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done CMake Error at CMakeLists.txt:15 (if): if given arguments: "CMAKE_AR" "MATCHES" "^WITH_LIB_[AZaz]+\$" "_lib" Unknown arguments specified Call Stack (most recent call first): CMakeLists.txt:22 (bsAddLibrary) -- 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
Re: [CMake] Question about IF and STRINGS
The problem is the line: if(${_var} MATCHES "^WITH_LIB_([AZaz]+)$") cmake_print_variables(CMAKE_MATCH_0) doesn't print me any output ... On 31.05.19 18:53, Steven Truppe wrote: Hi everyone, i try to create a build system where you can decide which libraries you want to use with variables like "WITH_LIB_GLFW" for example. every lib variable has other variables like WITH_LIB_GLFW_INC_PATH, WITH_LIB_GLFW_LIB_PATH, etc. so i can decide with cmake what libraries i'm going to use for the final executable. Now my problem is that i'm relative new to cmake and i'm learning c++11 in the meantime and are coding on a project so i don't have to much time for cmake (but it's a realy important part). Here is the code: cmake_minimum_required(VERSION 3.14 FATAL_ERROR) include(CMakePrintHelpers) set(WITH_LIB_GLAD "Support the GLAD library" 1) set(WITH_LIB_GLFW "Support for the GLFW library" 1) macro(bsAddLibrary lib) # get all WITH_LIB varables get_cmake_property(_variables VARIABLES) foreach(_var ${_variables}) # cmake_print_variables(${_var}) if(${_var} MATCHES "^WITH_LIB_[AZaz]+$" _lib) cmake_print_variables(${_lib}) endif() endforeach() endmacro() bsAddLibrary(WITH_LIB_GLAD) # Adds WITH_LIB_GLAD_INC_PATH and the other variables to a list for the main application that holds all inc path, compiler flags etc. ERROR: == -- The C compiler identification is GNU 6.3.0 -- The CXX compiler identification is GNU 6.3.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done CMake Error at CMakeLists.txt:15 (if): if given arguments: "CMAKE_AR" "MATCHES" "^WITH_LIB_[AZaz]+\$" "_lib" Unknown arguments specified Call Stack (most recent call first): CMakeLists.txt:22 (bsAddLibrary) -- 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
Re: [CMake] Question about IF and STRINGS
Found the problem, my regex was wrong [AZaz] should be [A-Za-z] ... On 31.05.19 19:07, Steven Truppe wrote: The problem is the line: if(${_var} MATCHES "^WITH_LIB_([AZaz]+)$") cmake_print_variables(CMAKE_MATCH_0) doesn't print me any output ... On 31.05.19 18:53, Steven Truppe wrote: Hi everyone, i try to create a build system where you can decide which libraries you want to use with variables like "WITH_LIB_GLFW" for example. every lib variable has other variables like WITH_LIB_GLFW_INC_PATH, WITH_LIB_GLFW_LIB_PATH, etc. so i can decide with cmake what libraries i'm going to use for the final executable. Now my problem is that i'm relative new to cmake and i'm learning c++11 in the meantime and are coding on a project so i don't have to much time for cmake (but it's a realy important part). Here is the code: cmake_minimum_required(VERSION 3.14 FATAL_ERROR) include(CMakePrintHelpers) set(WITH_LIB_GLAD "Support the GLAD library" 1) set(WITH_LIB_GLFW "Support for the GLFW library" 1) macro(bsAddLibrary lib) # get all WITH_LIB varables get_cmake_property(_variables VARIABLES) foreach(_var ${_variables}) # cmake_print_variables(${_var}) if(${_var} MATCHES "^WITH_LIB_[AZaz]+$" _lib) cmake_print_variables(${_lib}) endif() endforeach() endmacro() bsAddLibrary(WITH_LIB_GLAD) # Adds WITH_LIB_GLAD_INC_PATH and the other variables to a list for the main application that holds all inc path, compiler flags etc. ERROR: == -- The C compiler identification is GNU 6.3.0 -- The CXX compiler identification is GNU 6.3.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done CMake Error at CMakeLists.txt:15 (if): if given arguments: "CMAKE_AR" "MATCHES" "^WITH_LIB_[AZaz]+\$" "_lib" Unknown arguments specified Call Stack (most recent call first): CMakeLists.txt:22 (bsAddLibrary) -- 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
[CMake] Troubles with macros and STREQUAL
cmake_minimum_required(VERSION 3.14 FATAL_ERROR) include(CMakePrintHelpers) set(BSEDIT_INC_PATH "/usr/local/include") set(BSEDIT_LIB_PATH "/usr/incude/lib") set(WITH_LIB_GLAD "Support the GLAD library" 1) set(LIB_GLAD_INC_PATH "/usr/include/glad") set(LIB_GLAD_LIB_PATH "/usr/lib/glad") set(WITH_LIB_GLFW "Support for the GLFW library" 1) list(APPEND BSEDIT_INC_PATH ${LIB_GLAD_INC_PATH}) macro(bsAddLibrary lib) # get all WITH_LIB varables message(STATUS "${lib}") get_cmake_property(_variables VARIABLES) foreach(_var ${_variables}) -->> (${lib} is "WITH_LIB_GLAD" but allways return false =( if(_var STREQUAL ${lib}) message(STATUS "Found library: ${_var}") if(DEFINED ${${CMAKE_MATCH_0}_INC_PATH}) message(STATUS "FOUND GLAD_INC_PATH") endif() endif() endforeach() endmacro() bsAddLibrary(WITH_LIB_GLAD) message(STATUS "BSEDIT_INC_PATH = ${BSEDIT_INC_PATH}") message(STATUS "BSEDIT_LIB_PATH = ${BSEDIT_LIB_PATH}") -- 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
[CMake] Question about Variables
Hi everyone, i'm relative new to cmake (a few weeks now) and i have the following problem: set(WITH_LIB_GLAD 1) IF(DEFINED ${WITH_LIB_GLAD}_INC_PATH) I try to check if the variable WITH_LIB_GLAD_INC_PATH can be found. best regards! -- 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
[CMake] Question about INSTALL and cpack
Hi everyone, i'm relative new the cmake and i'm asking myself if i need the install command for ExternalProject_Add() since these commands also "install" the libraries needed at runtime. Or do i need the install command only for targets that i want to compile ? best regards! -- 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
[CMake] Question about properties.
Hi again, i'm reading up on properties and i see how to use set_properties and get_properties but i don't know how i can find out which properties exists for each entry (GLOBAL, DIRECTORY, TARGET, SOURCE, ...). How can i retrieve a property if i don't have a list with all available properties ? best regards! -- 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
[CMake] Question about running C code from within cmake
Hi everyone, i'm trying to search for a way for win32 to get the cpu core count. i found the c code: |SYSTEM_INFO sysinfo;GetSystemInfo(&sysinfo);intnumCPU =sysinfo.dwNumberOfProcessors; Is there a way i can get the return value numCPU and create a variable out of it ? for apple and linux i allready have a solution only win32 is left. best regards! | -- 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
[CMake] Question about regular expressions
Hi everyone, i had the same question a few days ago but can't rember the command (and can't find it in the cods): I have a regular expression like "WITH_LIB${lib}_EXAMPLE_([A-Za-z]+)" and i want the get the content of the found variables in the (), the command i used stored them if MATCH_XYZ but i can't exactly rember =(. best regards! -- 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
[CMake] General question:
Hi everyone again, i've the following code: https://paste.debian.net/1086040/ and i just try to traverse a list and include files whose part of the name are the list entries. best regards! -- 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
Re: [CMake] General question:
I want the output not to be 'in' but 'glade' ... On 04.06.19 17:10, Steven Truppe wrote: Hi everyone again, i've the following code: https://paste.debian.net/1086040/ and i just try to traverse a list and include files whose part of the name are the list entries. best regards! -- 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
[CMake] General question
Hi everyone, i have the following code: set(ALL_LIBS "glad;glfw") # WITH_LIB_GLAD option(WITH_LIB_GLAD 1) option(WITH_LIB_GLAD_EXAMPLE_BASIC "Build the basic Glad example (default:0)" 1) option(WITH_LIB_GLAD_EXAMPLE_SECOND "Build the second Glad example (default:0)" 1) # WITH_LIB_GLFW option(WITH_LIB_GLFW 1) option(WITH_LIB_GLFW_EXAMPLE_CBASIC "Build the basic GLFW C example (default:1)" 1) option(WITH_LIB_GLFW_EXAMPLE_CPPBASIC "Build the basic GLFW C example (default:1)" 1) ## bsBuildLib ## macro(bsBuildLibs libs) foreach(lib ${libs}) message(STATUS "Searching incude path for lib: <${lib}>") bsIncludeLibs(${lib}) bsBuildLibExamples(${lib}) endforeach() endmacro() ### ## bsIncludeLibs ## ### macro(bsIncludeLibs lib) message(STATUS "INCLUDE library ${lib}") include("lib_${lib}") endmacro() ## bsBuildLibExamples ## macro(bsBuildLibExamples lib) # get all examples foreach(_var in VARIABLES) string(TOUPPER ${lib} lib_upper) if(_var MATCHES "WITH_LIB_${lib_upper}_EXAMPLE_([A-Za-z]+)") message(STATUS "Found example: ${CMAKE_MATCH_0}") endif() endforeach() endmacro() The final result should be that i get the name of the examples, like for glad BASIC and SECOND and for glfw CBASIC and CPPBASIC. best regards! -- 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
[CMake] General question about regex
Hello again, i've the following variable defined: set(WITH_LIB_GLAD_EXAMPLE_BASIC 1) And the if the line foreach(_var VARIABLES) if(_var MATCHES "WITH_LIB_GLAD_EXAMPLE_([A-Za-z]+)") message(STATUS "Found a match") endforeach() I never get the message "Found match", what am i doing wrong here ?? -- 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
Re: [CMake] General question about regex
I found the solution: get_cmake_property(_vars VARIABLES) foreach(_var ${_vars}) string(TOUPPER ${lib} lib_upper) if(_var MATCHES "^WITH_LIB_${lib_upper}_EXAMPLE_([A-Za-z]+)$") message(STATUS "Number of examples found: ${CMAKE_MATCH_COUNT}") message(STATUS "Number 1 found: ${CMAKE_MATCH_0}") endif() endforeach() Now i've two problem - the CMAKE_MATCH_0 contains the hole string and not only the part the is in the (), i need only the part from the () - is there another command i can use for this ? On 04.06.19 18:47, Kornel Benko wrote: Am Dienstag, 4. Juni 2019, 18:10:19 CEST schrieb Steven Truppe: Hello again, i've the following variable defined: set(WITH_LIB_GLAD_EXAMPLE_BASIC 1) And the if the line foreach(_var VARIABLES) if(_var MATCHES "WITH_LIB_GLAD_EXAMPLE_([A-Za-z]+)") message(STATUS "Found a match") endforeach() I never get the message "Found match", what am i doing wrong here ?? What about the attached? Kornel -- 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
Re: [CMake] General question about regex
Thanks alot. My other problem i have no how can i loop over the result, there are just variables and ${CMAKE_CATCH_COUNT) what command can i use the iterate over the result ?? best regrads! On 04.06.19 19:22, Kyle Edwards wrote: On Tue, 2019-06-04 at 19:19 +0200, Steven Truppe wrote: I found the solution: get_cmake_property(_vars VARIABLES) foreach(_var ${_vars}) string(TOUPPER ${lib} lib_upper) if(_var MATCHES "^WITH_LIB_${lib_upper}_EXAMPLE_([A-Za- z]+)$") message(STATUS "Number of examples found: ${CMAKE_MATCH_COUNT}") message(STATUS "Number 1 found: ${CMAKE_MATCH_0}") endif() endforeach() Now i've two problem - the CMAKE_MATCH_0 contains the hole string and not only the part the is in the (), i need only the part from the () - is there another command i can use for this ? CMAKE_MATCH_1 Kyle -- 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
[CMake] General question about variable scope.
Hi everyone, i've the following code: macro(bsBuildLibExamples lib) # get all examples get_cmake_property(_vars VARIABLES) foreach(_var ${_vars}) string(TOUPPER ${lib} lib_upper) set(WITH_LIB_${lib_upper}_EXAMPLES "") if(_var MATCHES "^WITH_LIB_${lib_upper}_EXAMPLE_([A-Za-z]+)$") message(STATUS "Example found: ${CMAKE_MATCH_1}") list(APPEND ${WITH_LIB_${lib_upper}_EXAMPLES} ${CMAKE_MATCH_1}) endif() endforeach() message(STATUS "Glad examples: ${WITH_LIB_GLAD_EXAMPLES}") message(STATUS "GLFW examples: ${WITH_LIB_GLFW_EXAMPLES}") endmacro() The problem is that ${WITH_LIB_${lib_upper}_EXAMPLES} is not available anymore after the foreach, i was not able to find something in the docs about this, i hope someone here can help me out. best regrads! -- 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
[CMake] Question about looping inside a macro.
Hi everyone, like you know i'm relative new the cmake and i'm working my way through the book and the documentation but there is something that i don't understand in the docs. I just want to write a macro that uses as first argument a list and then iterates over it. The docs show the example: macro(_BAR) foreach(arg IN LISTS ARGN) [...] endforeach() endmacro() So i wrote this macro: macro(bsPrintList list) foreach(l IN LISTS ARGN) message(STATUS "List entry: ${l}) endforeach() endmacro() I tried all sorts of combinations like foreach(l ${list}) etc. but come to no result =(. This is a really easy questin so i hope someone can explain to me what i'm doing wrong here, next part i'm going to learn are functions and how to handle their arguments... best regards! -- 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
[CMake] Troubles with small CMakeLists.txt
Hi everyone, i finaly have solved the issues i had and now have the working code on: https://wandbox.org/permlink/ujEH8F91SVzMyt1D The problem is that the i only get the last result as output, he create the variables and stores them (i tested with cmake_print_variables) but at the end the resulting variables are empty - only the last one is correct I hope someone here can help. best regards! -- 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
Re: [CMake] Troubles with small CMakeLists.txt
I've made the code more readable and easy to understand so you don't have to read through all the code: https://wandbox.org/permlink/qp7ScGBeMOtolfxb On 05.06.19 00:47, Steven Truppe wrote: Hi everyone, i finaly have solved the issues i had and now have the working code on: https://wandbox.org/permlink/ujEH8F91SVzMyt1D The problem is that the i only get the last result as output, he create the variables and stores them (i tested with cmake_print_variables) but at the end the resulting variables are empty - only the last one is correct I hope someone here can help. best regards! -- 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
Re: [CMake] Troubles with small CMakeLists.txt
That was the issue - thanks alot for you help, i'm sitting now for over 5 hours in front of cmake and my eyes need some rest (and more brain needs more cmake knowledge:). best regards! On 05.06.19 01:13, stephan.sz...@sony.com wrote: Hi, Looking at the cmake there, your bsBuildLibExamples macro starts off by doing set(WITH_LIB_${lib_upper}_EXAMPLES "") but lib_upper isn't set to match the new value of lib until later inside the foreach. So it seems like you're resetting the value of the previous iteration. Moving the string(TOUPPER ${lib} lib_upper) to the top of the macro seems to make all the variables show up. Regards, Stephan -Original Message- From: CMake On Behalf Of Steven Truppe Sent: Tuesday, June 4, 2019 3:56 PM To: cmake@cmake.org Subject: Re: [CMake] Troubles with small CMakeLists.txt I've made the code more readable and easy to understand so you don't have to read through all the code: https://wandbox.org/permlink/qp7ScGBeMOtolfxb On 05.06.19 00:47, Steven Truppe wrote: Hi everyone, i finaly have solved the issues i had and now have the working code on: https://wandbox.org/permlink/ujEH8F91SVzMyt1D The problem is that the i only get the last result as output, he create the variables and stores them (i tested with cmake_print_variables) but at the end the resulting variables are empty - only the last one is correct I hope someone here can help. best regards! -- 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
[CMake] A bit harder question:
#- # This is the start #- ## bsBuildLibs ## # macro(bsBuildLibs) foreach(lib ${ARGN}) bsIncludeLib(${lib}) bsGetLibExamples(${lib}) bsIncludeLibExamples(${lib}) endforeach() endmacro() ## ## bsIncludeLib ## ## macro(bsIncludeLib) set(fn "${CMAKE_SOURCE_DIR}/tools/cmake/modules/lib_${ARGV0}.cmake") if(EXISTS ${fn}) include(lib_${ARGV0}) else() message(FATAL_ERROR "Unable to find library configuration file: ${lib_${ARGV0}}!") endif() endmacro() ## ## bsGetLibExamples ## ## macro(bsGetLibExamples) string(TOUPPER ${lib} lib_upper) set(WITH_LIB_${lib_upper}_EXAMPLES "") # get all examples get_cmake_property(_vars VARIABLES) foreach(_var ${_vars}) string(TOUPPER ${lib} lib_upper) if(_var MATCHES "^WITH_LIB_${lib_upper}_EXAMPLE_([A-Za-z]+)$") list(APPEND WITH_LIB_${lib_upper}_EXAMPLES ${CMAKE_MATCH_1}) endif() endforeach() endmacro() ### ## bsIncludeLibsExamples ## ### macro(bsIncludeLibExamples) foreach(lib ${ARGN}) string(TOUPPER ${lib} lib_upper) if(DEFINED "WITH_LIB_${lib_upper}_EXAMPLES") foreach(example IN LISTS WITH_LIB_${lib_upper}_EXAMPLES) string(TOLOWER ${example} example_lower) set(fn "${CMAKE_SOURCE_DIR}/tools/cmake/modules/lib_${lib}_example_${example_lower}.cmake") set(lib_name "lib_${lib}_example_${example_lower}") if(EXISTS ${fn}) message(STATUS "Bulding lib ${lib}, example: ${example}") include(${lib_name}) else() message(FATAL_ERROR "Could not find example file ${fn} for library ${lib} and (example: ${example_lower})!") endif() endforeach() endif() endforeach() endmacro() ## FIRST FILE I INCLUDE with inclde() ## set(ALL_LIBS "glad;glfw") set(WITH_LIB_GLAD 1) set(WITH_LIB_GLAD_EXAMPLE_CBASIC 1) set(WITH_LIB_GLFW 1) set(WITH_LIB_GLFW_EXAMPLE_CBASIC 1) set(WITH_LIB_GLFW_EXAMPLE_CPPBASIC 1) bsBuildLibs(${ALL_LIBS}) - if turns into loading different files that are part of the compilation: - First the ALL_LIBS list get looped and all examples for the libraries are filtered out - i then i have one example .cmake file for every example with the same name sheme as you see at the first set() lines like WITH_LIB_GLAD_EXAMPLE_CBASIC - this file is included and there should the build process be acompilshed (the filename here would be lib_glad_example_cbasic.c). Here is an example if lib_glad.cmake. - IF(WITH_LIB_GLAD) ### ## first example ## ### find_package(OpenGL REQUIRED) find_package(X11 REQUIRED) find_package(Threads REQUIRED) set(LIB_GLAD_INC_PATH ${OUTPUT_PATH}/glad/include ${OPENGL_INCLUDE_DIR} ${X11_INCLUDE_DIR} ) set(LIB_GLAD_LIB_PATH ${OUTPUT_PATH}/glad/lib ${OPENGL_LIBRARIES} ${X11_LIBRARIES} ) set(LIB_GLAD_STATIC_LIBS glad m rt ${CMAKE_DL_LIBS} OpenGL::GL Threads::Threads X11::X11 X11::Xxf86vm X11::Xi X11::Xrandr X11::Xcursor X11::Xinerama ) cmake_print_variables(OUTPUT_PATH) ExternalProject_Add(external_glad PREFIX ${CMAKE_BINARY_DIR}/glad-log GIT_REPOSITORY ${GLAD_REPO} GIT_TAG ${GLAD_TAG} GIT_PROGRESS true GIT_SHALLOW True SOURCE_DIR ${CMAKE_BINARY_DIR}/glad UPDATE_COMMAND "" PATCH_COMMAND "" INSTALL_DIR ${CMAKE_BINARY_DIR}/glad CMAKE_ARGS -DCMAKE_BUILD_TYPE:String=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${OUTPUT_PATH}/glad -DGLAD_INSTALL=True #CONFIGURE_COMMAND "" INSTALL_COMMAND "" ) ENDIF() ### ## second file i include ## ### IF(WITH_LIB_GLAD AND WITH_LIB_GLAD_EXAMPLE_CBASIC) add_executable(LIB_GLAD_EXAMPLE_CBASIC ${LIB_GLAD_EXAMPLE_CBASIC_SRC}) set(CMAKE_C_COMPILER ${LIB_GLAD_EXAMPLE_CBASIC_COMPILER}) cmake_print_variables(LIB_GLAD_INC_PATH) target_include_di
Re: [CMake] A bit harder question:
It's also odd that i have to include(ExternalProject) to use the command but i'm on cmake version 3.14 ... On 06.06.19 16:51, Steven Truppe wrote: #- # This is the start #- ## bsBuildLibs ## # macro(bsBuildLibs) foreach(lib ${ARGN}) bsIncludeLib(${lib}) bsGetLibExamples(${lib}) bsIncludeLibExamples(${lib}) endforeach() endmacro() ## ## bsIncludeLib ## ## macro(bsIncludeLib) set(fn "${CMAKE_SOURCE_DIR}/tools/cmake/modules/lib_${ARGV0}.cmake") if(EXISTS ${fn}) include(lib_${ARGV0}) else() message(FATAL_ERROR "Unable to find library configuration file: ${lib_${ARGV0}}!") endif() endmacro() ## ## bsGetLibExamples ## ## macro(bsGetLibExamples) string(TOUPPER ${lib} lib_upper) set(WITH_LIB_${lib_upper}_EXAMPLES "") # get all examples get_cmake_property(_vars VARIABLES) foreach(_var ${_vars}) string(TOUPPER ${lib} lib_upper) if(_var MATCHES "^WITH_LIB_${lib_upper}_EXAMPLE_([A-Za-z]+)$") list(APPEND WITH_LIB_${lib_upper}_EXAMPLES ${CMAKE_MATCH_1}) endif() endforeach() endmacro() ### ## bsIncludeLibsExamples ## ### macro(bsIncludeLibExamples) foreach(lib ${ARGN}) string(TOUPPER ${lib} lib_upper) if(DEFINED "WITH_LIB_${lib_upper}_EXAMPLES") foreach(example IN LISTS WITH_LIB_${lib_upper}_EXAMPLES) string(TOLOWER ${example} example_lower) set(fn "${CMAKE_SOURCE_DIR}/tools/cmake/modules/lib_${lib}_example_${example_lower}.cmake") set(lib_name "lib_${lib}_example_${example_lower}") if(EXISTS ${fn}) message(STATUS "Bulding lib ${lib}, example: ${example}") include(${lib_name}) else() message(FATAL_ERROR "Could not find example file ${fn} for library ${lib} and (example: ${example_lower})!") endif() endforeach() endif() endforeach() endmacro() ## FIRST FILE I INCLUDE with inclde() ## set(ALL_LIBS "glad;glfw") set(WITH_LIB_GLAD 1) set(WITH_LIB_GLAD_EXAMPLE_CBASIC 1) set(WITH_LIB_GLFW 1) set(WITH_LIB_GLFW_EXAMPLE_CBASIC 1) set(WITH_LIB_GLFW_EXAMPLE_CPPBASIC 1) bsBuildLibs(${ALL_LIBS}) - if turns into loading different files that are part of the compilation: - First the ALL_LIBS list get looped and all examples for the libraries are filtered out - i then i have one example .cmake file for every example with the same name sheme as you see at the first set() lines like WITH_LIB_GLAD_EXAMPLE_CBASIC - this file is included and there should the build process be acompilshed (the filename here would be lib_glad_example_cbasic.c). Here is an example if lib_glad.cmake. - IF(WITH_LIB_GLAD) ### ## first example ## ### find_package(OpenGL REQUIRED) find_package(X11 REQUIRED) find_package(Threads REQUIRED) set(LIB_GLAD_INC_PATH ${OUTPUT_PATH}/glad/include ${OPENGL_INCLUDE_DIR} ${X11_INCLUDE_DIR} ) set(LIB_GLAD_LIB_PATH ${OUTPUT_PATH}/glad/lib ${OPENGL_LIBRARIES} ${X11_LIBRARIES} ) set(LIB_GLAD_STATIC_LIBS glad m rt ${CMAKE_DL_LIBS} OpenGL::GL Threads::Threads X11::X11 X11::Xxf86vm X11::Xi X11::Xrandr X11::Xcursor X11::Xinerama ) cmake_print_variables(OUTPUT_PATH) ExternalProject_Add(external_glad PREFIX ${CMAKE_BINARY_DIR}/glad-log GIT_REPOSITORY ${GLAD_REPO} GIT_TAG ${GLAD_TAG} GIT_PROGRESS true GIT_SHALLOW True SOURCE_DIR ${CMAKE_BINARY_DIR}/glad UPDATE_COMMAND "" PATCH_COMMAND "" INSTALL_DIR ${CMAKE_BINARY_DIR}/glad CMAKE_ARGS -DCMAKE_BUILD_TYPE:String=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${OUTPUT_PATH}/glad -DGLAD_INSTALL=True #CONFIGURE_COMMAND "" INSTALL_COMMAND "" ) ENDIF() ###
Re: [CMake] A bit harder question:
I made a few misakes On 06.06.19 16:54, Steven Truppe wrote: It's also odd that i have to include(ExternalProject) to use the command but i'm on cmake version 3.14 ... On 06.06.19 16:51, Steven Truppe wrote: #- # This is the start #- ## bsBuildLibs ## # macro(bsBuildLibs) foreach(lib ${ARGN}) bsIncludeLib(${lib}) bsGetLibExamples(${lib}) bsIncludeLibExamples(${lib}) endforeach() endmacro() ## ## bsIncludeLib ## ## macro(bsIncludeLib) set(fn "${CMAKE_SOURCE_DIR}/tools/cmake/modules/lib_${ARGV0}.cmake") if(EXISTS ${fn}) include(lib_${ARGV0}) else() message(FATAL_ERROR "Unable to find library configuration file: ${lib_${ARGV0}}!") endif() endmacro() ## ## bsGetLibExamples ## ## macro(bsGetLibExamples) string(TOUPPER ${lib} lib_upper) set(WITH_LIB_${lib_upper}_EXAMPLES "") # get all examples get_cmake_property(_vars VARIABLES) foreach(_var ${_vars}) string(TOUPPER ${lib} lib_upper) if(_var MATCHES "^WITH_LIB_${lib_upper}_EXAMPLE_([A-Za-z]+)$") list(APPEND WITH_LIB_${lib_upper}_EXAMPLES ${CMAKE_MATCH_1}) endif() endforeach() endmacro() ### ## bsIncludeLibsExamples ## ### macro(bsIncludeLibExamples) foreach(lib ${ARGN}) string(TOUPPER ${lib} lib_upper) if(DEFINED "WITH_LIB_${lib_upper}_EXAMPLES") foreach(example IN LISTS WITH_LIB_${lib_upper}_EXAMPLES) string(TOLOWER ${example} example_lower) set(fn "${CMAKE_SOURCE_DIR}/tools/cmake/modules/lib_${lib}_example_${example_lower}.cmake") set(lib_name "lib_${lib}_example_${example_lower}") if(EXISTS ${fn}) message(STATUS "Bulding lib ${lib}, example: ${example}") include(${lib_name}) else() message(FATAL_ERROR "Could not find example file ${fn} for library ${lib} and (example: ${example_lower})!") endif() endforeach() endif() endforeach() endmacro() set(ALL_LIBS "glad;glfw") set(WITH_LIB_GLAD 1) set(WITH_LIB_GLAD_EXAMPLE_CBASIC 1) set(WITH_LIB_GLFW 1) set(WITH_LIB_GLFW_EXAMPLE_CBASIC 1) set(WITH_LIB_GLFW_EXAMPLE_CPPBASIC 1) bsBuildLibs(${ALL_LIBS}) - If turns into loading different files that are part of the compilation: - First the ALL_LIBS list get looped and all examples for the libraries are filtered out - i then i have one example .cmake file for every example with the same name sheme as you see at the first set() lines like . so 2 files: one with the ExternalExample_Add() command and one for the build process - in this example we have lib_glad.inc that is included first and the lib_glad_example_cbasic.cmake file for building an example. WITH_LIB_GLAD_EXAMPLE_CBASIC - this file is included and there should the build process be acompilshed (the filename here would be lib_glad_example_cbasic.c). Here is an example if lib_glad.cmake. - (lib_glad.cmake) IF(WITH_LIB_GLAD) ### ## first example ## ### find_package(OpenGL REQUIRED) find_package(X11 REQUIRED) find_package(Threads REQUIRED) set(LIB_GLAD_INC_PATH ${OUTPUT_PATH}/glad/include ${OPENGL_INCLUDE_DIR} ${X11_INCLUDE_DIR} ) set(LIB_GLAD_LIB_PATH ${OUTPUT_PATH}/glad/lib ${OPENGL_LIBRARIES} ${X11_LIBRARIES} ) set(LIB_GLAD_STATIC_LIBS glad m rt ${CMAKE_DL_LIBS} OpenGL::GL Threads::Threads X11::X11 X11::Xxf86vm X11::Xi X11::Xrandr X11::Xcursor X11::Xinerama ) cmake_print_variables(OUTPUT_PATH) ExternalProject_Add(external_glad PREFIX ${CMAKE_BINARY_DIR}/glad-log GIT_REPOSITORY ${GLAD_REPO} GIT_TAG ${GLAD_TAG} GIT_PROGRESS true GIT_SHALLOW True SOURCE_DIR ${CMAKE_BINARY_DIR}/glad UPDATE_COMMAND "" PATCH_COMMAND "" INSTALL_DIR ${CMAKE_BINARY_DIR}/glad CMAKE_ARGS -DCMAKE_BUILD_TYPE:String=${CMAKE_BUILD_TYPE} -D
[CMake] Strange properties issue
Hi again, i solved most of the problems, i have a single issue left: i have two files, in one file i do: set(WITH_LIB_GLAD_EXAMPLE_CBASIC_OUTPUT_NAME_RELEASE "demo") and in the next file i include i have: set_target_properties(LIB_GLAD_EXAMPLE_CBASIC PROPERTIES OUTPUT_NAME_RELEASE ${LIB_GLAD_EXAMPLE_CBASIC_OUTPUT_NAME_RELEASE}) . And as a result after make install i get: -- Set runtime path of "/media/stuv/linux-projects/programming/bsEdit/build_files/Debug/examples/glad_basic/LIB_GLAD_EXAMPLE_CBASIC" to "" And the filename of the build file is LIB_GLAD_EXAMPLE_CBASIC ... best regards. -- 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
Re: [CMake] Strange properties issue
On 06.06.19 19:37, Steven Truppe wrote: Hi again, i solved most of the problems, i have a single issue left: i have two files, in one file i do: set(WITH_LIB_GLAD_EXAMPLE_CBASIC_OUTPUT_NAME_RELEASE "demo") and in the next file i include i have: set_target_properties(LIB_GLAD_EXAMPLE_CBASIC PROPERTIES OUTPUT_NAME_RELEASE ${WITH_LIB_GLAD_EXAMPLE_CBASIC_OUTPUT_NAME_RELEASE}) . And as a result after make install i get: -- Set runtime path of "/media/stuv/linux-projects/programming/bsEdit/build_files/Debug/examples/glad_basic/LIB_GLAD_EXAMPLE_CBASIC" to "" And the filename of the build file is LIB_GLAD_EXAMPLE_CBASIC ... best regards. -- 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
Re: [CMake] Strange properties issue
I missed the property - it's DEBUG_OUTPUT_NAME and RELEASE_OUTPUT_NAME, sry.. On 06.06.19 19:51, Steven Truppe wrote: On 06.06.19 19:37, Steven Truppe wrote: Hi again, i solved most of the problems, i have a single issue left: i have two files, in one file i do: set(WITH_LIB_GLAD_EXAMPLE_CBASIC_OUTPUT_NAME_RELEASE "demo") and in the next file i include i have: set_target_properties(LIB_GLAD_EXAMPLE_CBASIC PROPERTIES OUTPUT_NAME_RELEASE ${WITH_LIB_GLAD_EXAMPLE_CBASIC_OUTPUT_NAME_RELEASE}) . And as a result after make install i get: -- Set runtime path of "/media/stuv/linux-projects/programming/bsEdit/build_files/Debug/examples/glad_basic/LIB_GLAD_EXAMPLE_CBASIC" to "" And the filename of the build file is LIB_GLAD_EXAMPLE_CBASIC ... best regards. -- 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
[CMake] Troubles with ExternalProject_Add.
Hi everyone, I've troubles with ExternalProject_Add: when i do build the library manualy (clone the repo and build it with mkdir build;cd build; cmake -DCMAKE_BUILD_TYPE:String=Release -DGLAD_INSTALL=ON -DCMAKE_INSTALL_PREFIX=/home/stuv/glad_examples) it does work and i've the installation at /home/stuv/glad_examples. But the external project add seems to miss an argument because he doesn't install anything. Here the code of ExternalProject_Add: ExternalProject_Add(external_glad PREFIX ${CMAKE_BINARY_DIR}/glad GIT_REPOSITORY ${GLAD_REPO} GIT_TAG ${GLAD_TAG} GIT_PROGRESS true GIT_SHALLOW True SOURCE_DIR ${CMAKE_BINARY_DIR}/glad-src INSTALL_DIR ${CMAKE_BINARY_DIR}/glad-download CMAKE_ARGS -DCMAKE_BUILD_TYPE:String=${CMAKE_BUILD_TYPE} -DGLAD_INSTALL=ON -DCMAKE_INSTALL_PREFIX=${OUTPUT_PATH}/glad ) I hope someone here does see my problem. best regards! -- 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
Re: [CMake] Troubles with ExternalProject_Add.
Found the error, thank you anyway - you guys are allways a good way to get help about cmake, i'm starting to understand cmake slowly but it's getting easier and easier, cmake is a great build system. best regards! On 08.06.19 14:47, Steven Truppe wrote: Hi everyone, I've troubles with ExternalProject_Add: when i do build the library manualy (clone the repo and build it with mkdir build;cd build; cmake -DCMAKE_BUILD_TYPE:String=Release -DGLAD_INSTALL=ON -DCMAKE_INSTALL_PREFIX=/home/stuv/glad_examples) it does work and i've the installation at /home/stuv/glad_examples. But the external project add seems to miss an argument because he doesn't install anything. Here the code of ExternalProject_Add: ExternalProject_Add(external_glad PREFIX ${CMAKE_BINARY_DIR}/glad GIT_REPOSITORY ${GLAD_REPO} GIT_TAG ${GLAD_TAG} GIT_PROGRESS true GIT_SHALLOW True SOURCE_DIR ${CMAKE_BINARY_DIR}/glad-src INSTALL_DIR ${CMAKE_BINARY_DIR}/glad-download CMAKE_ARGS -DCMAKE_BUILD_TYPE:String=${CMAKE_BUILD_TYPE} -DGLAD_INSTALL=ON -DCMAKE_INSTALL_PREFIX=${OUTPUT_PATH}/glad ) I hope someone here does see my problem. best regards! -- 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
[CMake] Question about config_file.
Hi everyone, currently i'm trying to build my doxygen documentation from my CMakeLists.txt file. I found the following example that seems to be correct: ## ## bsBuildDoxygen() ## ## macro(bsBuildDocs) if(GENERATE_DOCS) # check if Doxygen is installed find_package(Doxygen) if(DOXYGEN_FOUND) # set input and output files set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/doc/manual/Doxyfile.in) set(DOXYGEN_OUT ${CMAKE_CURRENT_SOURCE_DIR}/doc/manual/Doxyfile) # request to configure the file configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY) message("Doxygen build started") # note the option ALL which allows to build the docs together with the application add_custom_target( doc_doxygen ALL COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "Generating API documentation with Doxygen" VERBATIM ) else() message("Doxygen need to be installed to generate the doxygen documentation") endif() endif() endmacro() Now my question is about the configure_file command. what is Doxygen.in and what is the configure_file command for ? best regards! -- 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
[CMake] Question about getting git branch name.
Hi everyone, i want to have code lines like: #define BUILD_VERSION and the BUILD_VERSION should be the name of the actual branch the code was compiled with, this way i can create a branch for each version and name it like 0.1 so each version i'm using for release is an own branch. I found many examples that shows me the branch name (like git status) but i don't know a way to get only the name of the current branch so i can for example execute_process to get the revision number into a variable and then use add_definition(..) to add it as a compile definition. best regards! -- 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
[CMake] Question about a simple macro.
Hi everyone, i'm a c,c++,asm and a few other languages, but i still have troubles with macros and their arguments. As a simple example i would like to have a macro that list(APPEND the two passed arguments), here the code i tried: https://wandbox.org/permlink/WQZGty9PQaOz3422. Let's forget about the list(APPEND) line, i just need an example that prints me out the first and the second argument and i'm not able to get it right. Would someone please explain to me how i can do this right ? I've read the book but that didn't helped me completely. I hope someone here is so nice to me to explain to me how i can write the bsMergeFlags macro and explains me what i'm doing wrong and how to correct it. I played around alot but can't get it right. best regards! -- 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
Re: [CMake] Question about a simple macro.
Do i need cmake_parse_arguments ?? On 09.06.19 07:01, Steven Truppe wrote: Hi everyone, i'm a c,c++,asm and a few other languages, but i still have troubles with macros and their arguments. As a simple example i would like to have a macro that list(APPEND the two passed arguments), here the code i tried: https://wandbox.org/permlink/WQZGty9PQaOz3422. Let's forget about the list(APPEND) line, i just need an example that prints me out the first and the second argument and i'm not able to get it right. Would someone please explain to me how i can do this right ? I've read the book but that didn't helped me completely. I hope someone here is so nice to me to explain to me how i can write the bsMergeFlags macro and explains me what i'm doing wrong and how to correct it. I played around alot but can't get it right. best regards! -- 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
Re: [CMake] Question about a simple macro.
ARGV1 gives me the first list entry of my first arguments, but i don't know how i can access the hole list. best regards! On 09.06.19 07:20, Steven Truppe wrote: Do i need cmake_parse_arguments ?? On 09.06.19 07:01, Steven Truppe wrote: Hi everyone, i'm a c,c++,asm and a few other languages, but i still have troubles with macros and their arguments. As a simple example i would like to have a macro that list(APPEND the two passed arguments), here the code i tried: https://wandbox.org/permlink/WQZGty9PQaOz3422. Let's forget about the list(APPEND) line, i just need an example that prints me out the first and the second argument and i'm not able to get it right. Would someone please explain to me how i can do this right ? I've read the book but that didn't helped me completely. I hope someone here is so nice to me to explain to me how i can write the bsMergeFlags macro and explains me what i'm doing wrong and how to correct it. I played around alot but can't get it right. best regards! -- 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
Re: [CMake] Question about a simple macro.
OK, i don't realy understand why it does work but i got it working: include(CMakePrintHelpers) macro(bsMergeFlags flags_to_add flags) set(flags_to_add ${flags_to_add} ${ARGN} ) cmake_print_variables(flags_to_add) message(STATUS "bsMergeFlags ${flags_to_add}") list(APPEND flags ${tmp}) message(STATUS "") endmacro() Now my problem is that the content of flags_to_add is correct when i use cmake_print_variables but not when i try to use it in a message() call. I think i do miss some very important part when it comes to variables - i'm now studying the hole chapter again, hopefully i understand it then. I hope you guys can help me. best regards! On 09.06.19 08:26, Steven Truppe wrote: ARGV1 gives me the first list entry of my first arguments, but i don't know how i can access the hole list. best regards! On 09.06.19 07:20, Steven Truppe wrote: Do i need cmake_parse_arguments ?? On 09.06.19 07:01, Steven Truppe wrote: Hi everyone, i'm a c,c++,asm and a few other languages, but i still have troubles with macros and their arguments. As a simple example i would like to have a macro that list(APPEND the two passed arguments), here the code i tried: https://wandbox.org/permlink/WQZGty9PQaOz3422. Let's forget about the list(APPEND) line, i just need an example that prints me out the first and the second argument and i'm not able to get it right. Would someone please explain to me how i can do this right ? I've read the book but that didn't helped me completely. I hope someone here is so nice to me to explain to me how i can write the bsMergeFlags macro and explains me what i'm doing wrong and how to correct it. I played around alot but can't get it right. best regards! -- 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
Re: [CMake] Question about a simple macro.
How on earth can i create a variables out of the string flags_to_add ??? On 09.06.19 08:41, Steven Truppe wrote: OK, i don't realy understand why it does work but i got it working: include(CMakePrintHelpers) macro(bsMergeFlags flags_to_add flags) set(flags_to_add ${flags_to_add} ${ARGN} ) cmake_print_variables(flags_to_add) message(STATUS "bsMergeFlags ${flags_to_add}") list(APPEND flags ${tmp}) message(STATUS "") endmacro() Now my problem is that the content of flags_to_add is correct when i use cmake_print_variables but not when i try to use it in a message() call. I think i do miss some very important part when it comes to variables - i'm now studying the hole chapter again, hopefully i understand it then. I hope you guys can help me. best regards! On 09.06.19 08:26, Steven Truppe wrote: ARGV1 gives me the first list entry of my first arguments, but i don't know how i can access the hole list. best regards! On 09.06.19 07:20, Steven Truppe wrote: Do i need cmake_parse_arguments ?? On 09.06.19 07:01, Steven Truppe wrote: Hi everyone, i'm a c,c++,asm and a few other languages, but i still have troubles with macros and their arguments. As a simple example i would like to have a macro that list(APPEND the two passed arguments), here the code i tried: https://wandbox.org/permlink/WQZGty9PQaOz3422. Let's forget about the list(APPEND) line, i just need an example that prints me out the first and the second argument and i'm not able to get it right. Would someone please explain to me how i can do this right ? I've read the book but that didn't helped me completely. I hope someone here is so nice to me to explain to me how i can write the bsMergeFlags macro and explains me what i'm doing wrong and how to correct it. I played around alot but can't get it right. best regards! -- 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
Re: [CMake] Question about a simple macro.
Problem solved - thanks anyway... On 09.06.19 09:11, Steven Truppe wrote: How on earth can i create a variables out of the string flags_to_add ??? On 09.06.19 08:41, Steven Truppe wrote: OK, i don't realy understand why it does work but i got it working: include(CMakePrintHelpers) macro(bsMergeFlags flags_to_add flags) set(flags_to_add ${flags_to_add} ${ARGN} ) cmake_print_variables(flags_to_add) message(STATUS "bsMergeFlags ${flags_to_add}") list(APPEND flags ${tmp}) message(STATUS "") endmacro() Now my problem is that the content of flags_to_add is correct when i use cmake_print_variables but not when i try to use it in a message() call. I think i do miss some very important part when it comes to variables - i'm now studying the hole chapter again, hopefully i understand it then. I hope you guys can help me. best regards! On 09.06.19 08:26, Steven Truppe wrote: ARGV1 gives me the first list entry of my first arguments, but i don't know how i can access the hole list. best regards! On 09.06.19 07:20, Steven Truppe wrote: Do i need cmake_parse_arguments ?? On 09.06.19 07:01, Steven Truppe wrote: Hi everyone, i'm a c,c++,asm and a few other languages, but i still have troubles with macros and their arguments. As a simple example i would like to have a macro that list(APPEND the two passed arguments), here the code i tried: https://wandbox.org/permlink/WQZGty9PQaOz3422. Let's forget about the list(APPEND) line, i just need an example that prints me out the first and the second argument and i'm not able to get it right. Would someone please explain to me how i can do this right ? I've read the book but that didn't helped me completely. I hope someone here is so nice to me to explain to me how i can write the bsMergeFlags macro and explains me what i'm doing wrong and how to correct it. I played around alot but can't get it right. best regards! -- 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
[CMake] Troubles with ExternalProject_Add and PATCH_COMMAND
Hi everyone, i try to patch a file from an externalprojects with the PATCH_COMMAND. The patch file looks like: --- project-config.jam 2019-07-18 17:21:44.008695808 +0200 +++ project-config.jam.tmp 2019-07-18 17:23:28.236474532 +0200 @@ -18,7 +18,7 @@ import python ; if ! [ python.configured ] { - using python : 2.7 : /usr ; + using python : 3.7 : /usr ; } path-constant ICU_PATH : /usr ; When i try to apply the patch manualy with patch originalfile < patchfile it's working, but when i try it with the externalproject_add command: if(WITH_LIB_BOOST) message(STATUS "Build WITH_LIB_BOOST.") set(LIB_BOOST_INC_PATH ${OUTPUT_PATH}/libs/boost/include/) set(LIB_BOOST_LIB_PATH ${OUTPUT_PATH}/libs/boost/lib) set(LIB_BOOST_DEPS external_boost) set(LIB_BOOST_STATIC_LIBS boost_python27) ExternalProject_Add(external_boost PREFIX ${CMAKE_BINARY_DIR}/boost URL ${BOOST_URL} DOWNLOAD_DIR ${CMAKE_BINARY_DIR}/boost URL_HASH MD5=${BOOST_HASH} PATCH_COMMAND /usr/bin/patch ${CMAKE_BINARY_DIR}/boost/src/external_boost/project-config.jam < ${CMAKE_SOURCE_DIR}/tools/patches/boost_python3.7.patch CONFIGURE_COMMAND cd ${CMAKE_BINARY_DIR}/boost/src/external_boost/ && ./bootstrap.sh --prefix=${OUTPUT_PATH}/libs/boost/ --with-libraries=python BUILD_COMMAND cd ${CMAKE_BINARY_DIR}/boost/src/external_boost/ && ./b2 INSTALL_COMMAND cd ${CMAKE_BINARY_DIR}/boost/src/external_boost/ && ./bjam && ./bjam install INSTALL_DIR ${OUTPUT_PATH}/boost ) endif() But when running cmake i get the following output: patching file /home/stuv/projects/programming/bsEdit/build/boost/src/external_boost/project-config.jam Hunk #1 FAILED at 18. I have no idea what i'm doing wrong here, i hope someone here can help me out. 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
[CMake] Test example with list(FIND inside a macro.
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