When is ExternalProject_Add created?

I want to create openssl and link my project with it. In my project, I have a library called net that uses parts openssl. So, in my net \ CMakeList, I added

include_directories(
    ../
  + ../../../ext/openssl/inc32/
)
add_library(net STATIC ${sources})
+ ADD_DEPENDENCIES(net openssl)

In my ext folder, which is used to organize the entire external library, I have a new unpacked openssl source code in a folder called openssl. Then I edited the ext \ CmakeList file

message(STATUS "Configuring OpenSSL")
set(openssl_dir openssl)
if (CMAKE_CL_64)
include(ExternalProject)

set(OPENSSL_CONFIGURE perl\ Configure\ VC-WIN64A)
set(OPENSSL_MAKE  ms\\do_win64a\ &&\ nmake\ -f\ ms\\ntdll.mak)

ExternalProject_Add(openssl
    PREFIX openssl
    #-- Download Step ----------
    SOURCE_DIR ${CMAKE_SOURCE_DIR}/ext/openssl
    #--Configure step ----------
        CONFIGURE_COMMAND ${OPENSSL_CONFIGURE}
    #--Build Step ----------
    BUILD_COMMAND ${OPENSSL_MAKE}
    BUILD_IN_SOURCE 1
    #--install Step ----------
    INSTALL_COMMAND ""} 
)

endif()

When I built, the compiler complained that it could not find the include file, and the openssl source code was not created at all, since there are no out32dll and inc32.

My question is when does this ExternalProject_Add actually create the project. If I create my network library, it depends on openssl, does this mean that when I create a network, first I need to check and build openssl?

Thanks Jerry

+4
2

, , . . :

nmake -f "ms\ntdll.mak"

, ExternalProject_Add:

ExternalProject_Add(
    OpenSSL
    URL https://github.com/openssl/openssl/archive/OpenSSL_1_0_1h.tar.gz
    CONFIGURE_COMMAND perl Configure VC-WIN64A "--prefix=${CMAKE_INSTALL_PREFIX}"
    BUILD_COMMAND "ms\\do_win64a.bat"
    COMMAND nmake -f "ms\\ntdll.mak"
    BUILD_IN_SOURCE 1
    INSTALL_COMMAND nmake -f "ms\\ntdll.mak" install
)

OpenSSL

-, openssl, find_package (OpenSSL):

find_package(OpenSSL REQUIRED)
message("Libs: ${OPENSSL_LIBRARIES}")
message("Includes: ${OPENSSL_INCLUDE_DIR}")

, , :) , . Superbuild, ExternalProject_Add, , . , openssl - .

Fix

. superbuild ( openssl):

> cmake -Hsuperbuild -B_builds\superbuild "-GVisual Studio 12 2013 Win64" -DCMAKE_INSTALL_PREFIX=ext\install
# note, no ext\install directory yet
> cmake --build _builds\superbuild
# install done, libraries can be found in ext\install

, , , :

> cmake -Huse -B_builds\use "-GVisual Studio 12 2013 Win64" -DCMAKE_INSTALL_PREFIX=ext\install
-- Found OpenSSL: .../ext/install/lib/ssleay32.lib;.../ext/install/lib/libeay32.lib (found version "1.0.1h")
Libs: .../ext/install/lib/ssleay32.lib;.../ext/install/lib/libeay32.lib
Includes: .../ext/install/include
> cmake --build _builds\use
# OK

, (Windows Visual Studio 2013):

hunter_add_package(OpenSSL)
find_package(OpenSSL REQUIRED)
+1

ExternalProject add_custom_target

. ADD_DEPENDENCIES .

, , .

  • ExternalProject_Add ?

    ( ).

  • openssl, , , openssl?

    . , cmake , openssl .

PS: . cmake , openssl, . " boost cmake" . add_library IMPORTED GLOBAL set_target_properties IMPORTED_LOCATION_*

+2

Source: https://habr.com/ru/post/1546669/


All Articles