[CMake] Problems with EnternalProjectAdd
Michael Ellery
mellery451 at gmail.com
Tue Feb 19 12:11:56 EST 2019
Here’s a complete example that works on my system - maybe you can tweak it to your liking:
cmake_minimum_required (VERSION 3.9.0)
include (ExternalProject)
project (simple_ep)
set(BUILD_ENV "${CMAKE_BINARY_DIR}/build_env" CACHE STRING INTERNAL)
ExternalProject_Add(
freetype
PREFIX "${BUILD_ENV}/freetype"
GIT_REPOSITORY "https://github.com/brooklynpacket/freetype2.git"
GIT_TAG 64bit
BUILD_IN_SOURCE true
CONFIGURE_COMMAND
./autogen.sh
COMMAND
./configure
BUILD_COMMAND
make
TEST_COMMAND ""
INSTALL_COMMAND ""
LOG_DOWNLOAD ON
LOG_INSTALL ON
LOG_CONFIGURE ON
LOG_BUILD ON
LOG_TEST ON
LOG_INSTALL ON
)
add_library (ft_lib STATIC IMPORTED GLOBAL)
ExternalProject_Get_Property (freetype SOURCE_DIR)
set_target_properties (ft_lib PROPERTIES
IMPORTED_LOCATION
${SOURCE_DIR}/objs/.libs/libfreetype.a)
add_dependencies (ft_lib freetype)
add_executable (app main.cpp)
target_link_libraries(app ft_lib)
-Mike
> On Feb 18, 2019, at 10:25 PM, Workbench at gmx.at <workbench at gmx.at> wrote:
>
> Can't i somehow output the pwd ??
>
> best regards!
>
> On 19.02.19 07:04, Workbench at gmx.at wrote:
>> Now i'm getting:
>>
>> Command failed: No such file or directory
>>
>> 'cd /home/stuv/data/projects/programming/bsUltimate/build/build_env/freetype/src/freetype && ./autogen.sh && ./configure && make'
>>
>> but when i go to my bsUltimate path and type that command it works...
>>
>>
>>
>> best regards!
>>
>> On 19.02.19 06:57, Romain LEGUAY wrote:
>>> Hi,
>>>
>>> I think you need to set the variable CONFIGURE_COMMAND to empty like this:
>>>
>>>> ExternalProject_Add(
>>>> freetype
>>>> PREFIX "${BUILD_ENV}/freetype"
>>>> GIT_REPOSITORY "https://github.com/brooklynpacket/freetype2.git"
>>>> GIT_TAG 64bit
>>> CONFIGURE_COMMAND ""
>>>> BUILD_COMMAND "cd ${CMAKE_BUILD_DIR}/freetype/src/freetype && ./autgen.sh && ./configure && make"
>>>> LOG_DOWNLOAD ON
>>>> LOG_INSTALL ON
>>>> LOG_CONFIGURE ON
>>>> LOG_BUILD ON
>>>> LOG_TEST ON
>>>> LOG_INSTALL ON
>>>> )
>>>
>>> Envoyé de mon iPad
>>>
>>> Le 19 févr. 2019 à 06:51, Workbench at gmx.at <workbench at gmx.at> a écrit :
>>>
>>>> I played around a bit a now have the following:
>>>>
>>>> set(BUILD_ENV "${CMAKE_BINARY_DIR}/build_env" CACHE STRING INTERNAL)
>>>> set(LIBRARY_DIR "${CMAKE_BINARY_DIR}/lib" CACHE STRING INTERNAL)
>>>>
>>>> ExternalProject_Add(
>>>> freetype
>>>> PREFIX "${BUILD_ENV}/freetype"
>>>> GIT_REPOSITORY "https://github.com/brooklynpacket/freetype2.git"
>>>> GIT_TAG 64bit
>>>> BUILD_COMMAND "cd ${CMAKE_BUILD_DIR}/freetype/src/freetype && ./autgen.sh && ./configure && make"
>>>> LOG_DOWNLOAD ON
>>>> LOG_INSTALL ON
>>>> LOG_CONFIGURE ON
>>>> LOG_BUILD ON
>>>> LOG_TEST ON
>>>> LOG_INSTALL ON
>>>> )
>>>>
>>>> The logs are telling me: CMake Error: The source directory "/home/stuv/data/projects/programming/bsUltimate/build/build_env/freetype/src/freetype" does not appear to contain CMakeLists.txt.
>>>>
>>>> Isn't the BUILD_COMMAND there if there is no CMakeLists.txt file available for building ? not many project provide cmake build files....
>>>>
>>>>
>>>> best regards!
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On 19.02.19 06:43, Michael Ellery wrote:
>>>>> CMAKE_BUILD_DIR is not a standard variable (did you mean CMAKE_BINARY_DIR ?) - and the error seems to indicate that the variable is indeed empty so it tries to create the project directory at the root level.
>>>>>
>>>>> -Mike
>>>>>
>>>>>> On Feb 18, 2019, at 8:58 PM, Workbench at gmx.at <workbench at gmx.at> wrote:
>>>>>>
>>>>>> Hi again,
>>>>>>
>>>>>> i try to install my dependencies with ExternalProjectAdd but it gives me troubles... what's wrong with
>>>>>>
>>>>>>
>>>>>> ExternalProject_Add(
>>>>>> freetype
>>>>>> PREFIX "${CMAKE_BUILD_DIR}/freetype"
>>>>>> GIT_REPOSITORY "https://github.com/brooklynpacket/freetype2.git"
>>>>>> GIT_TAG 64bit
>>>>>> BUILD_COMMAND "cd ${CMAKE_BUILD_DIR}/freetype/src/freetype && ./autgen.sh && ./configure && make"
>>>>>> LOG_DOWNLOAD ON
>>>>>> LOG_INSTALL ON
>>>>>> LOG_CONFIGURE ON
>>>>>> LOG_BUILD ON
>>>>>> LOG_TEST ON
>>>>>> LOG_INSTALL ON
>>>>>> )
>>>>>>
>>>>>> 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
>>>>>
>>>> --
>>>>
>>>> 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
>>
>
> --
>
> 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
More information about the CMake
mailing list