Problem with ExternalProject_Add

Hello,

I have a little problem with ExternalProject_Add when I try to use find command.

ExternalProject_Add(libopc
    GIT_REPOSITORY https://github.com/freuter/libopc.git
    UPDATE_DISCONNECTED True
    CONFIGURE_COMMAND cd <SOURCE_DIR>
    COMMAND find -name configure -exec chmod +x {} \;
        COMMAND ./configure --with-zlib=yes
            --with-zlib-ldflags="`pkg-config zlib --libs`"
            --with-libxml=yes
            --with-libxml-cppflags="`pkg-config libxml-2.0 --cflags`"
            --with-libxml-ldflags="`pkg-config libxml-2.0 --libs`"
        COMMAND make -j4 install
    BUILD_IN_SOURCE 1
    BUILD_COMMAND cd <SOURCE_DIR> COMMAND make -j 8
    INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}"
)

When I build my project, I can see where the problem is :

[  2%] Performing configure step for 'libopc'
cd /work/TRAVAIL/prog/Apps/UFC/ufcacl.1/ufcacl/build/libopc-prefix/src/libopc && cd /work/TRAVAIL/prog/Apps/UFC/ufcacl.1/ufcacl/build/libopc-prefix/src/libopc
cd /work/TRAVAIL/prog/Apps/UFC/ufcacl.1/ufcacl/build/libopc-prefix/src/libopc && find -name configure -exec chmod +x {} "" ""
find: missing argument to `-exec'

How to resolv that ?

Cheers

Jean-Michel

It looks like your find command is missing a path between find and -name. Place a path there (often you just want .) and see if that changes your error. You will also need to escape the backslash at the end of that command, since CMake will swallow that thinking you intend to escape the semicolon for CMake’s own parsing. The end result of that line might look something like this:

COMMAND find . -name configure -exec chmod +x {} \\;

Hello,

I’ve modified my CMakeLists.txt file.

ExternalProject_Add(libopc
    GIT_REPOSITORY http://gogs.caricand.fr/jmcaricand/libopc.git
    UPDATE_DISCONNECTED True
    CONFIGURE_COMMAND cd <SOURCE_DIR>
        COMMAND find . -name configure -exec chmod +x {} \\;
        COMMAND ./configure --with-zlib=yes
            --with-zlib-ldflags="`pkg-config zlib --libs`"
            --with-libxml=yes
            --with-libxml-cppflags="`pkg-config libxml-2.0 --cflags`"
            --with-libxml-ldflags="`pkg-config libxml-2.0 --libs`"
        COMMAND make -j4 install
    BUILD_IN_SOURCE 1
    # Construction
    BUILD_COMMAND cd <SOURCE_DIR> COMMAND make -j 8
    # RĂ©pertoire d'installation
    INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}"
)

I still have the same error.

cat build/CMakeFiles/libopc.dir/build.make
...
   cd /tmp/d/build/libopc-prefix/src/libopc && find . -name configure -exec chmod +x {} “” “”
...

Do you have another idea?

Ah, yes I forgot the semicolon will cause problems. Replace that semicolon with $<SEMICOLON>.

1 Like

Hello,

That works with this command :

find . -name configure -exec chmod +x {} $<SEMICOLON>

Thank you