I came a step forward, now it looks like this:

include(ExternalProject)
ExternalProject_Add(glfw3
    PREFIX ${CMAKE_BINARY_DIR}/glfw-log
    GIT_REPOSITORY https://github.com/glfw/glfw.git
    GIT_TAG 3.2.1
    SOURCE_DIR ${CMAKE_BINARY_DIR}/glfw
    UPDATE_COMMAND ""
    PATCH_COMMAND ""
    INSTALL_DIR ${CMAKE_BINARY_DIR}/glfw
    CMAKE_ARGS -DCMAKE_BUILD_TYPE:String={CMAKE_BUILD_TYPE}
-DCMAKE_INSTALL_PREFIX=${LIB_DIR}/glfw
)

ExternalProject_Add(glad
    PREFIX ${CMAKE_BINARY_DIR}/glad-log
    GIT_REPOSITORY https://github.com/Dav1dde/glad.git
    GIT_TAG v0.1.29
    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=${LIB_DIR}/glad -DGLAD_EXPORT=True
-DGLAD_INSTALL=True
    CONFIGURE_COMMAND ${CMAKE_BUILD_DIR}/
    INSTALL_COMMAND
        COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_BINARY_DIR}/glad-log/src/glad-build/libglad.a
${LIB_DIR}/glad/lib/libglad.a
        COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_BINARY_DIR}/glad-log/src/glad-build/include ${LIB_DIR}/glad/
)
find_package(glad REQUIRED)
find_package(glfw3 REQUIRED)
add_executable(Test01 source/test/Test01.cpp)
target_link_libraries(Test01 PRIVATE glad glfw3)

But now i've the following problem, i get the error message:

CMake Error at CMakeLists.txt:95 (find_package):
  By not providing "Findglad.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "glad", but
  CMake did not find one.

  Could not find a package configuration file provided by "glad" with any of
  the following names:

    gladConfig.cmake
    glad-config.cmake

  Add the installation prefix of "glad" to CMAKE_PREFIX_PATH or set
  "glad_DIR" to a directory containing one of the above files.  If "glad"
  provides a separate development package or SDK, be sure it has been
  installed.

The problem is gladConfig.cmake is created after the configure
procedure, how can i solve this issue ??


best regards!




On 10.03.19 11:44, workbe...@gmx.at wrote:
>
> Now i've managed to create the right INSTALL_COMMAND but i don't know
> how to link with my executable. i tried
>
> add_executable(MyApp ${src})
>
> target_link_libraries(MyApp STATIC GLFW GLAD)
>
> and i get the following error message:
>
> CMake Error at CMakeLists.txt:96 (target_link_libraries):
>   Target "LIBGLAD" of type UTILITY may not be linked into another target.
>   One may link only to INTERFACE, OBJECT, STATIC or SHARED libraries,
> or to
>   executables with the ENABLE_EXPORTS property set.
>
>
> CMake Error at CMakeLists.txt:96 (target_link_libraries):
>   Target "LIBGLFW" of type UTILITY may not be linked into another target.
>   One may link only to INTERFACE, OBJECT, STATIC or SHARED libraries,
> or to
>   executables with the ENABLE_EXPORTS property set.
>
>
>
> target_link_libraries(M
>
> On 10.03.19 10:40, workbe...@gmx.at wrote:
>> Hi everyone,
>>
>> i've managed to use ExternalProject_Add to install GLFW but i have
>> troubles with glad...
>>
>> Here is my code for GLFW wich is working:
>>
>> include(ExternalProject)
>> ExternalProject_Add(GLFW
>>     PREFIX ${LIBDIR}/${CMAKE_BUILD_TYPE}/glfw-log
>>     GIT_REPOSITORY https://github.com/glfw/glfw.git
>>     GIT_TAG 3.2.1
>>     SOURCE_DIR ${CMAKE_BINARY_DIR}/glfw
>>     UPDATE_COMMAND ""
>>     PATCH_COMMAND ""
>>     INSTALL_DIR ${LIBDIR}/glfw
>>     CMAKE_ARGS -DCMAKE_BUILD_TYPE:String={CMAKE_BUILD_TYPE}
>> -DCMAKE_INSTALL_PREFIX=${LIB_DIR}/glfw
>> )
>>
>> Now i tried the same with GLAD but i had to add INSTALL_COMMAND to make
>> it work but i've no clue what i should enter there to install it the
>> same way i did with glfw..
>>
>> ExternalProject_Add(GLAD
>>     PREFIX ${LIBDIR}/${CMAKE_BUILD_TYPE}/glad-log
>>     GIT_REPOSITORY https://github.com/Dav1dde/glad.git
>>     GIT_TAG v0.1.29
>>     SOURCE_DIR ${CMAKE_BINARY_DIR}/glad
>>     UPDATE_COMMAND ""
>>     PATCH_COMMAND ""
>>     INSTALL_DIR ${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/glad
>>     CMAKE_ARGS -DCMAKE_BUILD_TYPE:String=${CMAKE_BUILD_TYPE}
>> -DCMAKE_INSTALL_PREFIX=${LIB_DIR}/glad
>>     INSTALL_COMMAND "??"
>> )
>>
>>
>> I hope someone can help me, i'm a bit clueless about this.
>>
>>
>> best regards!
>>
>>
>

Attachment: pEpkey.asc
Description: application/pgp-keys

-- 

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

Reply via email to