CMakeLists.txt not in root directory, can't do an automatic build










1














I have an issue with a repository not having its CMakeLists in the root directory, namely https://github.com/lz4/lz4
The CMakeLists.txt is in the subfolder contrib/cmake_unofficial.



I already checked similar questions on SO (Is it possible to have cmake build file (CMakeLists.txt) not in root in CLion, cmake - CMakeLists.txt is not in root folder (but is included in source)), but they only provide alternatives, and not a solution applicable to my situation.



Heres the cmake module I came up with:



if(ENABLE_LZ4)
message(STATUS "Using LZ4.")
set(CMAKE_CXX_FLAGS "$CMAKE_CXX_FLAGS -DENABLE_LZ4")

# Enable ExternalProject CMake module
include(ExternalProject)

set(LZ4_SOURCE_DIR $CMAKE_CURRENT_BINARY_DIR/lz4)
set(LZ4_BINARY_DIR $CMAKE_CURRENT_BINARY_DIR/lib)
# Download and install lz4
ExternalProject_Add(
lz4
GIT_REPOSITORY https://github.com/lz4/lz4.git
GIT_TAG dev
SOURCE_DIR $LZ4_SOURCE_DIR
BINARY_DIR $LZ4_BINARY_DIR
INSTALL_COMMAND ""
CMAKE_ARGS
$LZ4_SOURCE_DIR/contrib/cmake_unofficial
-DCMAKE_C_COMPILER=$CMAKE_C_COMPILER
)

# Get lz4 source and binary directories from CMake project
ExternalProject_Get_Property(lz4 source_dir binary_dir)

# Create a liblz4 target to be used as a dependency by the program
add_library(liblz4 IMPORTED SHARED GLOBAL)
add_dependencies(liblz4 lz4)

include_directories(
$LZ4_SOURCE_DIR/lib
)
set(LZ4_LIB $LZ4_BINARY_DIR/liblz4.so)
else()
message(STATUS "Not using LZ4.")
set(LZ4_LIB "")
endif()


Here the complete error output:



[ 0%] Performing update step for 'lz4'
Current branch dev is up to date.
[ 1%] Performing configure step for 'lz4'
CMake Error: The source directory "/****/build/lz4" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
CMakeFiles/lz4.dir/build.make:105: recipe for target 'lz4-prefix/src/lz4-stamp/lz4-configure' failed
make[2]: *** [lz4-prefix/src/lz4-stamp/lz4-configure] Error 1
CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/lz4.dir/all' failed
make[1]: *** [CMakeFiles/lz4.dir/all] Error 2
Makefile:94: recipe for target 'all' failed
make: *** [all] Error 2


I tried adding the path 'contrib/cmake_unofficial' to the CMAKE_ARGS variable (as seen in the module above), but it does not work (seems to be ignored?).



I also tried using PATCH_COMMAND to copy the CMakeLists.txt to the root before the build starts, but the relative paths of the file get messed up.
In other words, i need the cmake command to be called to build the library to be : cmake contrib/cmake_unofficial.



I also tried using CONFIGURE_COMMAND for this, but keep getting a file not found error for some reason (even though the path is correct).
The module has some other issues too, but I'm only interested in the non-root CMakeLists.



Thanks in advance!










share|improve this question




























    1














    I have an issue with a repository not having its CMakeLists in the root directory, namely https://github.com/lz4/lz4
    The CMakeLists.txt is in the subfolder contrib/cmake_unofficial.



    I already checked similar questions on SO (Is it possible to have cmake build file (CMakeLists.txt) not in root in CLion, cmake - CMakeLists.txt is not in root folder (but is included in source)), but they only provide alternatives, and not a solution applicable to my situation.



    Heres the cmake module I came up with:



    if(ENABLE_LZ4)
    message(STATUS "Using LZ4.")
    set(CMAKE_CXX_FLAGS "$CMAKE_CXX_FLAGS -DENABLE_LZ4")

    # Enable ExternalProject CMake module
    include(ExternalProject)

    set(LZ4_SOURCE_DIR $CMAKE_CURRENT_BINARY_DIR/lz4)
    set(LZ4_BINARY_DIR $CMAKE_CURRENT_BINARY_DIR/lib)
    # Download and install lz4
    ExternalProject_Add(
    lz4
    GIT_REPOSITORY https://github.com/lz4/lz4.git
    GIT_TAG dev
    SOURCE_DIR $LZ4_SOURCE_DIR
    BINARY_DIR $LZ4_BINARY_DIR
    INSTALL_COMMAND ""
    CMAKE_ARGS
    $LZ4_SOURCE_DIR/contrib/cmake_unofficial
    -DCMAKE_C_COMPILER=$CMAKE_C_COMPILER
    )

    # Get lz4 source and binary directories from CMake project
    ExternalProject_Get_Property(lz4 source_dir binary_dir)

    # Create a liblz4 target to be used as a dependency by the program
    add_library(liblz4 IMPORTED SHARED GLOBAL)
    add_dependencies(liblz4 lz4)

    include_directories(
    $LZ4_SOURCE_DIR/lib
    )
    set(LZ4_LIB $LZ4_BINARY_DIR/liblz4.so)
    else()
    message(STATUS "Not using LZ4.")
    set(LZ4_LIB "")
    endif()


    Here the complete error output:



    [ 0%] Performing update step for 'lz4'
    Current branch dev is up to date.
    [ 1%] Performing configure step for 'lz4'
    CMake Error: The source directory "/****/build/lz4" does not appear to contain CMakeLists.txt.
    Specify --help for usage, or press the help button on the CMake GUI.
    CMakeFiles/lz4.dir/build.make:105: recipe for target 'lz4-prefix/src/lz4-stamp/lz4-configure' failed
    make[2]: *** [lz4-prefix/src/lz4-stamp/lz4-configure] Error 1
    CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/lz4.dir/all' failed
    make[1]: *** [CMakeFiles/lz4.dir/all] Error 2
    Makefile:94: recipe for target 'all' failed
    make: *** [all] Error 2


    I tried adding the path 'contrib/cmake_unofficial' to the CMAKE_ARGS variable (as seen in the module above), but it does not work (seems to be ignored?).



    I also tried using PATCH_COMMAND to copy the CMakeLists.txt to the root before the build starts, but the relative paths of the file get messed up.
    In other words, i need the cmake command to be called to build the library to be : cmake contrib/cmake_unofficial.



    I also tried using CONFIGURE_COMMAND for this, but keep getting a file not found error for some reason (even though the path is correct).
    The module has some other issues too, but I'm only interested in the non-root CMakeLists.



    Thanks in advance!










    share|improve this question


























      1












      1








      1







      I have an issue with a repository not having its CMakeLists in the root directory, namely https://github.com/lz4/lz4
      The CMakeLists.txt is in the subfolder contrib/cmake_unofficial.



      I already checked similar questions on SO (Is it possible to have cmake build file (CMakeLists.txt) not in root in CLion, cmake - CMakeLists.txt is not in root folder (but is included in source)), but they only provide alternatives, and not a solution applicable to my situation.



      Heres the cmake module I came up with:



      if(ENABLE_LZ4)
      message(STATUS "Using LZ4.")
      set(CMAKE_CXX_FLAGS "$CMAKE_CXX_FLAGS -DENABLE_LZ4")

      # Enable ExternalProject CMake module
      include(ExternalProject)

      set(LZ4_SOURCE_DIR $CMAKE_CURRENT_BINARY_DIR/lz4)
      set(LZ4_BINARY_DIR $CMAKE_CURRENT_BINARY_DIR/lib)
      # Download and install lz4
      ExternalProject_Add(
      lz4
      GIT_REPOSITORY https://github.com/lz4/lz4.git
      GIT_TAG dev
      SOURCE_DIR $LZ4_SOURCE_DIR
      BINARY_DIR $LZ4_BINARY_DIR
      INSTALL_COMMAND ""
      CMAKE_ARGS
      $LZ4_SOURCE_DIR/contrib/cmake_unofficial
      -DCMAKE_C_COMPILER=$CMAKE_C_COMPILER
      )

      # Get lz4 source and binary directories from CMake project
      ExternalProject_Get_Property(lz4 source_dir binary_dir)

      # Create a liblz4 target to be used as a dependency by the program
      add_library(liblz4 IMPORTED SHARED GLOBAL)
      add_dependencies(liblz4 lz4)

      include_directories(
      $LZ4_SOURCE_DIR/lib
      )
      set(LZ4_LIB $LZ4_BINARY_DIR/liblz4.so)
      else()
      message(STATUS "Not using LZ4.")
      set(LZ4_LIB "")
      endif()


      Here the complete error output:



      [ 0%] Performing update step for 'lz4'
      Current branch dev is up to date.
      [ 1%] Performing configure step for 'lz4'
      CMake Error: The source directory "/****/build/lz4" does not appear to contain CMakeLists.txt.
      Specify --help for usage, or press the help button on the CMake GUI.
      CMakeFiles/lz4.dir/build.make:105: recipe for target 'lz4-prefix/src/lz4-stamp/lz4-configure' failed
      make[2]: *** [lz4-prefix/src/lz4-stamp/lz4-configure] Error 1
      CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/lz4.dir/all' failed
      make[1]: *** [CMakeFiles/lz4.dir/all] Error 2
      Makefile:94: recipe for target 'all' failed
      make: *** [all] Error 2


      I tried adding the path 'contrib/cmake_unofficial' to the CMAKE_ARGS variable (as seen in the module above), but it does not work (seems to be ignored?).



      I also tried using PATCH_COMMAND to copy the CMakeLists.txt to the root before the build starts, but the relative paths of the file get messed up.
      In other words, i need the cmake command to be called to build the library to be : cmake contrib/cmake_unofficial.



      I also tried using CONFIGURE_COMMAND for this, but keep getting a file not found error for some reason (even though the path is correct).
      The module has some other issues too, but I'm only interested in the non-root CMakeLists.



      Thanks in advance!










      share|improve this question















      I have an issue with a repository not having its CMakeLists in the root directory, namely https://github.com/lz4/lz4
      The CMakeLists.txt is in the subfolder contrib/cmake_unofficial.



      I already checked similar questions on SO (Is it possible to have cmake build file (CMakeLists.txt) not in root in CLion, cmake - CMakeLists.txt is not in root folder (but is included in source)), but they only provide alternatives, and not a solution applicable to my situation.



      Heres the cmake module I came up with:



      if(ENABLE_LZ4)
      message(STATUS "Using LZ4.")
      set(CMAKE_CXX_FLAGS "$CMAKE_CXX_FLAGS -DENABLE_LZ4")

      # Enable ExternalProject CMake module
      include(ExternalProject)

      set(LZ4_SOURCE_DIR $CMAKE_CURRENT_BINARY_DIR/lz4)
      set(LZ4_BINARY_DIR $CMAKE_CURRENT_BINARY_DIR/lib)
      # Download and install lz4
      ExternalProject_Add(
      lz4
      GIT_REPOSITORY https://github.com/lz4/lz4.git
      GIT_TAG dev
      SOURCE_DIR $LZ4_SOURCE_DIR
      BINARY_DIR $LZ4_BINARY_DIR
      INSTALL_COMMAND ""
      CMAKE_ARGS
      $LZ4_SOURCE_DIR/contrib/cmake_unofficial
      -DCMAKE_C_COMPILER=$CMAKE_C_COMPILER
      )

      # Get lz4 source and binary directories from CMake project
      ExternalProject_Get_Property(lz4 source_dir binary_dir)

      # Create a liblz4 target to be used as a dependency by the program
      add_library(liblz4 IMPORTED SHARED GLOBAL)
      add_dependencies(liblz4 lz4)

      include_directories(
      $LZ4_SOURCE_DIR/lib
      )
      set(LZ4_LIB $LZ4_BINARY_DIR/liblz4.so)
      else()
      message(STATUS "Not using LZ4.")
      set(LZ4_LIB "")
      endif()


      Here the complete error output:



      [ 0%] Performing update step for 'lz4'
      Current branch dev is up to date.
      [ 1%] Performing configure step for 'lz4'
      CMake Error: The source directory "/****/build/lz4" does not appear to contain CMakeLists.txt.
      Specify --help for usage, or press the help button on the CMake GUI.
      CMakeFiles/lz4.dir/build.make:105: recipe for target 'lz4-prefix/src/lz4-stamp/lz4-configure' failed
      make[2]: *** [lz4-prefix/src/lz4-stamp/lz4-configure] Error 1
      CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/lz4.dir/all' failed
      make[1]: *** [CMakeFiles/lz4.dir/all] Error 2
      Makefile:94: recipe for target 'all' failed
      make: *** [all] Error 2


      I tried adding the path 'contrib/cmake_unofficial' to the CMAKE_ARGS variable (as seen in the module above), but it does not work (seems to be ignored?).



      I also tried using PATCH_COMMAND to copy the CMakeLists.txt to the root before the build starts, but the relative paths of the file get messed up.
      In other words, i need the cmake command to be called to build the library to be : cmake contrib/cmake_unofficial.



      I also tried using CONFIGURE_COMMAND for this, but keep getting a file not found error for some reason (even though the path is correct).
      The module has some other issues too, but I'm only interested in the non-root CMakeLists.



      Thanks in advance!







      cmake lz4






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 12 at 12:18

























      asked Nov 12 at 11:14









      Tasche

      305




      305






















          2 Answers
          2






          active

          oldest

          votes


















          2














          ExternalProject separates download and source directories:




          • DOWNLOAD_DIR - a directory where downloading step is performed


          • SOURCE_DIR - a directory used as a source one when configuration step is performed

          When use git for extract the project, note that git clone is called from the download directory, where it creates new directory with a project sources.



          set(LZ4_DOWNLOAD_DIR $CMAKE_CURRENT_BINARY_DIR/lz4)
          # Set a source dir based on the download one.
          set(LZ4_SOURCE_DIR $LZ4_DOWNLOAD_DIR/lz4/contrib/cmake_unofficial)
          set(LZ4_BINARY_DIR $CMAKE_CURRENT_BINARY_DIR/lib)
          # Download and install lz4
          ExternalProject_Add(
          lz4
          DOWNLOAD_DIR $LZ4_DOWNLOAD_DIR # Set download directory explicitely
          GIT_REPOSITORY https://github.com/lz4/lz4.git
          GIT_TAG dev
          SOURCE_DIR $LZ4_SOURCE_DIR
          BINARY_DIR $LZ4_BINARY_DIR
          ...
          )





          share|improve this answer




















          • Thanks for the answer, I actually also tried that, i.e. using DOWNLOAD_DIR.
            – Tasche
            Nov 13 at 8:46










          • Edit: What happened, is that SOURCE_DIR still seemed to override that, and the repo was cloned into .../contrib/cmake_unofficial instead.
            – Tasche
            Nov 13 at 8:54


















          1














          Probably not the correct way to do it, but this seems to work for me.
          I used the CONFIGURE_COMMAND to call cmake on the correct directory.
          Then use BUILD_COMMAND to call make
          So essentially, it breaks down to this:



          ExternalProject_Add(
          lz4
          GIT_REPOSITORY https://github.com/lz4/lz4.git
          GIT_TAG dev
          SOURCE_DIR $LZ4_SOURCE_DIR
          BINARY_DIR $LZ4_BINARY_DIR
          CONFIGURE_COMMAND cmake $LZ4_SOURCE_DIR/contrib/cmake_unofficial
          BUILD_COMMAND make
          INSTALL_COMMAND ""
          CMAKE_ARGS
          -DCMAKE_C_COMPILER=$CMAKE_C_COMPILER
          )





          share|improve this answer






















            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53260989%2fcmakelists-txt-not-in-root-directory-cant-do-an-automatic-build%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            ExternalProject separates download and source directories:




            • DOWNLOAD_DIR - a directory where downloading step is performed


            • SOURCE_DIR - a directory used as a source one when configuration step is performed

            When use git for extract the project, note that git clone is called from the download directory, where it creates new directory with a project sources.



            set(LZ4_DOWNLOAD_DIR $CMAKE_CURRENT_BINARY_DIR/lz4)
            # Set a source dir based on the download one.
            set(LZ4_SOURCE_DIR $LZ4_DOWNLOAD_DIR/lz4/contrib/cmake_unofficial)
            set(LZ4_BINARY_DIR $CMAKE_CURRENT_BINARY_DIR/lib)
            # Download and install lz4
            ExternalProject_Add(
            lz4
            DOWNLOAD_DIR $LZ4_DOWNLOAD_DIR # Set download directory explicitely
            GIT_REPOSITORY https://github.com/lz4/lz4.git
            GIT_TAG dev
            SOURCE_DIR $LZ4_SOURCE_DIR
            BINARY_DIR $LZ4_BINARY_DIR
            ...
            )





            share|improve this answer




















            • Thanks for the answer, I actually also tried that, i.e. using DOWNLOAD_DIR.
              – Tasche
              Nov 13 at 8:46










            • Edit: What happened, is that SOURCE_DIR still seemed to override that, and the repo was cloned into .../contrib/cmake_unofficial instead.
              – Tasche
              Nov 13 at 8:54















            2














            ExternalProject separates download and source directories:




            • DOWNLOAD_DIR - a directory where downloading step is performed


            • SOURCE_DIR - a directory used as a source one when configuration step is performed

            When use git for extract the project, note that git clone is called from the download directory, where it creates new directory with a project sources.



            set(LZ4_DOWNLOAD_DIR $CMAKE_CURRENT_BINARY_DIR/lz4)
            # Set a source dir based on the download one.
            set(LZ4_SOURCE_DIR $LZ4_DOWNLOAD_DIR/lz4/contrib/cmake_unofficial)
            set(LZ4_BINARY_DIR $CMAKE_CURRENT_BINARY_DIR/lib)
            # Download and install lz4
            ExternalProject_Add(
            lz4
            DOWNLOAD_DIR $LZ4_DOWNLOAD_DIR # Set download directory explicitely
            GIT_REPOSITORY https://github.com/lz4/lz4.git
            GIT_TAG dev
            SOURCE_DIR $LZ4_SOURCE_DIR
            BINARY_DIR $LZ4_BINARY_DIR
            ...
            )





            share|improve this answer




















            • Thanks for the answer, I actually also tried that, i.e. using DOWNLOAD_DIR.
              – Tasche
              Nov 13 at 8:46










            • Edit: What happened, is that SOURCE_DIR still seemed to override that, and the repo was cloned into .../contrib/cmake_unofficial instead.
              – Tasche
              Nov 13 at 8:54













            2












            2








            2






            ExternalProject separates download and source directories:




            • DOWNLOAD_DIR - a directory where downloading step is performed


            • SOURCE_DIR - a directory used as a source one when configuration step is performed

            When use git for extract the project, note that git clone is called from the download directory, where it creates new directory with a project sources.



            set(LZ4_DOWNLOAD_DIR $CMAKE_CURRENT_BINARY_DIR/lz4)
            # Set a source dir based on the download one.
            set(LZ4_SOURCE_DIR $LZ4_DOWNLOAD_DIR/lz4/contrib/cmake_unofficial)
            set(LZ4_BINARY_DIR $CMAKE_CURRENT_BINARY_DIR/lib)
            # Download and install lz4
            ExternalProject_Add(
            lz4
            DOWNLOAD_DIR $LZ4_DOWNLOAD_DIR # Set download directory explicitely
            GIT_REPOSITORY https://github.com/lz4/lz4.git
            GIT_TAG dev
            SOURCE_DIR $LZ4_SOURCE_DIR
            BINARY_DIR $LZ4_BINARY_DIR
            ...
            )





            share|improve this answer












            ExternalProject separates download and source directories:




            • DOWNLOAD_DIR - a directory where downloading step is performed


            • SOURCE_DIR - a directory used as a source one when configuration step is performed

            When use git for extract the project, note that git clone is called from the download directory, where it creates new directory with a project sources.



            set(LZ4_DOWNLOAD_DIR $CMAKE_CURRENT_BINARY_DIR/lz4)
            # Set a source dir based on the download one.
            set(LZ4_SOURCE_DIR $LZ4_DOWNLOAD_DIR/lz4/contrib/cmake_unofficial)
            set(LZ4_BINARY_DIR $CMAKE_CURRENT_BINARY_DIR/lib)
            # Download and install lz4
            ExternalProject_Add(
            lz4
            DOWNLOAD_DIR $LZ4_DOWNLOAD_DIR # Set download directory explicitely
            GIT_REPOSITORY https://github.com/lz4/lz4.git
            GIT_TAG dev
            SOURCE_DIR $LZ4_SOURCE_DIR
            BINARY_DIR $LZ4_BINARY_DIR
            ...
            )






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 12 at 14:55









            Tsyvarev

            25.5k42558




            25.5k42558











            • Thanks for the answer, I actually also tried that, i.e. using DOWNLOAD_DIR.
              – Tasche
              Nov 13 at 8:46










            • Edit: What happened, is that SOURCE_DIR still seemed to override that, and the repo was cloned into .../contrib/cmake_unofficial instead.
              – Tasche
              Nov 13 at 8:54
















            • Thanks for the answer, I actually also tried that, i.e. using DOWNLOAD_DIR.
              – Tasche
              Nov 13 at 8:46










            • Edit: What happened, is that SOURCE_DIR still seemed to override that, and the repo was cloned into .../contrib/cmake_unofficial instead.
              – Tasche
              Nov 13 at 8:54















            Thanks for the answer, I actually also tried that, i.e. using DOWNLOAD_DIR.
            – Tasche
            Nov 13 at 8:46




            Thanks for the answer, I actually also tried that, i.e. using DOWNLOAD_DIR.
            – Tasche
            Nov 13 at 8:46












            Edit: What happened, is that SOURCE_DIR still seemed to override that, and the repo was cloned into .../contrib/cmake_unofficial instead.
            – Tasche
            Nov 13 at 8:54




            Edit: What happened, is that SOURCE_DIR still seemed to override that, and the repo was cloned into .../contrib/cmake_unofficial instead.
            – Tasche
            Nov 13 at 8:54













            1














            Probably not the correct way to do it, but this seems to work for me.
            I used the CONFIGURE_COMMAND to call cmake on the correct directory.
            Then use BUILD_COMMAND to call make
            So essentially, it breaks down to this:



            ExternalProject_Add(
            lz4
            GIT_REPOSITORY https://github.com/lz4/lz4.git
            GIT_TAG dev
            SOURCE_DIR $LZ4_SOURCE_DIR
            BINARY_DIR $LZ4_BINARY_DIR
            CONFIGURE_COMMAND cmake $LZ4_SOURCE_DIR/contrib/cmake_unofficial
            BUILD_COMMAND make
            INSTALL_COMMAND ""
            CMAKE_ARGS
            -DCMAKE_C_COMPILER=$CMAKE_C_COMPILER
            )





            share|improve this answer



























              1














              Probably not the correct way to do it, but this seems to work for me.
              I used the CONFIGURE_COMMAND to call cmake on the correct directory.
              Then use BUILD_COMMAND to call make
              So essentially, it breaks down to this:



              ExternalProject_Add(
              lz4
              GIT_REPOSITORY https://github.com/lz4/lz4.git
              GIT_TAG dev
              SOURCE_DIR $LZ4_SOURCE_DIR
              BINARY_DIR $LZ4_BINARY_DIR
              CONFIGURE_COMMAND cmake $LZ4_SOURCE_DIR/contrib/cmake_unofficial
              BUILD_COMMAND make
              INSTALL_COMMAND ""
              CMAKE_ARGS
              -DCMAKE_C_COMPILER=$CMAKE_C_COMPILER
              )





              share|improve this answer

























                1












                1








                1






                Probably not the correct way to do it, but this seems to work for me.
                I used the CONFIGURE_COMMAND to call cmake on the correct directory.
                Then use BUILD_COMMAND to call make
                So essentially, it breaks down to this:



                ExternalProject_Add(
                lz4
                GIT_REPOSITORY https://github.com/lz4/lz4.git
                GIT_TAG dev
                SOURCE_DIR $LZ4_SOURCE_DIR
                BINARY_DIR $LZ4_BINARY_DIR
                CONFIGURE_COMMAND cmake $LZ4_SOURCE_DIR/contrib/cmake_unofficial
                BUILD_COMMAND make
                INSTALL_COMMAND ""
                CMAKE_ARGS
                -DCMAKE_C_COMPILER=$CMAKE_C_COMPILER
                )





                share|improve this answer














                Probably not the correct way to do it, but this seems to work for me.
                I used the CONFIGURE_COMMAND to call cmake on the correct directory.
                Then use BUILD_COMMAND to call make
                So essentially, it breaks down to this:



                ExternalProject_Add(
                lz4
                GIT_REPOSITORY https://github.com/lz4/lz4.git
                GIT_TAG dev
                SOURCE_DIR $LZ4_SOURCE_DIR
                BINARY_DIR $LZ4_BINARY_DIR
                CONFIGURE_COMMAND cmake $LZ4_SOURCE_DIR/contrib/cmake_unofficial
                BUILD_COMMAND make
                INSTALL_COMMAND ""
                CMAKE_ARGS
                -DCMAKE_C_COMPILER=$CMAKE_C_COMPILER
                )






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 13 at 8:50

























                answered Nov 12 at 12:52









                Tasche

                305




                305



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53260989%2fcmakelists-txt-not-in-root-directory-cant-do-an-automatic-build%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    這個網誌中的熱門文章

                    How to read a connectionString WITH PROVIDER in .NET Core?

                    In R, how to develop a multiplot heatmap.2 figure showing key labels successfully

                    Museum of Modern and Contemporary Art of Trento and Rovereto