CMakeLists.txt not in the root source folder

Sysprogs forums Forums VisualGDB CMakeLists.txt not in the root source folder

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #8029
    JochenBaier
    Participant

    Hello,

    we want to use VisualGDB with a cmake project. But our CMakeLists.txt is not in the root source folder. But VisualGDB assumes the CMakeLists.txt in the root of  the local or remote source folder.
    Can we use an CMakeLists.txt from an different directory?

    like
    parentFolder <-this is the folder which contains all sources (in subfolder) but not the CMakeLists.txt
    folderA
    CMakeLists.txt <—Main CMakeLists.txt
    sourcefile1.cpp
    sourcefile2.cpp
    folderB
    CMakeLists.txt <— Library, included in CMakeLists.txt
    sourcefile1.cpp
    sourcefile1.cpp

    Thanks Jochen

     

     

    #8032
    support
    Keymaster

    Hi,

    Yes, you can change the “CMakeLists.txt directory” field on the CMake Settings page of VisualGDB Project Properties.

    #8046
    JochenBaier
    Participant

    Hi,

    mmh can not change that directory: In the “New Linux Project” wizard on the page “Common build settings”  the textbox “Directory with CMakeLists.txt” is disabled (textbox and button is gray).
    Unter Project->Visual GDB Project Properties->CMake  project properties a Messagebox appears with content ‘Could not find file ‘….rootfolder\CMakeLists.txt”.  Clicking “Ok” the complete property windows is closing…

     

    Jochen

     

     

    #8055
    support
    Keymaster

    Hi,

    The wizard layout depends on whether you are using a cross-compiler and where do you store the source files. Please provide us more details on the previous choices in the wizard so that we could check why it is disabled.

    As an alternative solution you can import the project from folderA, select “Do not import files to Solution Explorer” and then add the root folder manually via Add->Import Folder Recursively. This way the main source directory from the VisualGDB’s point of view will be folderA, but the Solution Explorer contents will look like you have imported the parent folder. Let us know if that works.

    #8122
    JochenBaier
    Participant

    Hi,

    wizard steps: Linux Project Wizard->Import a CMake project ->Build the projet under Linux over network (ssh settings…)->Next->Connecting too (ok)->The Sources are located on the Windows computer (parentFolder)
    ->Next->Setup Shares and mount points manually (pathes as suggested)

    Now unter Common build settings wizard page the “Directory with CMakeLists.txt” is disabled.

     

    #8123
    JochenBaier
    Participant

    alternative solution: works with an reduced example if i after, Import Folder Recursivley, generate the CMake Build system new with the Project settings->Build subsytem combobox ‘Cmake’ entry (not currently selected).

    But now only one main.cpp in a sub folder is visibly in the visual studio solution explorer. A second main.cpp is missing in the parent folder.

    #8132
    support
    Keymaster

    Hi,

    Thanks for the details, the CMakeLists.txt location is indeed read-only in this case as the wizard makes no distinction between the root source directory (that will be transferred during builds) and the root build directory (that contains CMakeLists.txt). It’s not very trivial to fix, so we have added a note in the 5.2 fix list, but won’t promise anything at this point. As a workaround you can create an empty CMakeLists.txt in the root directory, create the project and then change the CMakeLists.txt location via VisualGDB Project Properties.

    Regarding the second missing file, it looks like a separate issue. Is VisualGDB importing the directory contents directly at the root of the project node (e.g. just <project>\main.cpp rather than <project>\dir1\main.cpp)? If yes, please try creating a new virtual folder for your directory, right-clicking on it and then selecting “Import a directory recursively” so that VisualGDB will import the directory contents there.

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.