New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customizable build folder for CMake plugin #1474

Closed
MonJamp opened this Issue Nov 17, 2016 · 10 comments

Comments

Projects
None yet
4 participants
@MonJamp

MonJamp commented Nov 17, 2016

Instead of always making the build folder for CMake project WORKSPACE_PATH/cmake-build-<CONFIGURATION_NAME>, I believe it should be PROJECT_PATH/<CONFIGURATION_NAME>. This way multiple CMake projects can be built in a workspace without conflict and it would be consistent with Makefile generator output.

@eranif

This comment has been minimized.

Show comment
Hide comment
@eranif

eranif Nov 19, 2016

Owner

Did you encounter a specific problem that triggers you to open this bug? or is it a suggestion?

Owner

eranif commented Nov 19, 2016

Did you encounter a specific problem that triggers you to open this bug? or is it a suggestion?

@eranif

This comment has been minimized.

Show comment
Hide comment
@eranif

eranif Nov 19, 2016

Owner

FYI: I am asking because CodeLite always generates a workspace CMakeLists.txt file for the workspace and then for the project(s).

The Workspace level CMakeLists.txt mainly contains a bunch of add_subdirectory commands for each project folder

Owner

eranif commented Nov 19, 2016

FYI: I am asking because CodeLite always generates a workspace CMakeLists.txt file for the workspace and then for the project(s).

The Workspace level CMakeLists.txt mainly contains a bunch of add_subdirectory commands for each project folder

@MonJamp

This comment has been minimized.

Show comment
Hide comment
@MonJamp

MonJamp Nov 19, 2016

Looks like I hit a bug then, the workspace didn't have a CMakeLists.txt (maybe I accidentally deleted it). I noticed that CodeLite would try to run cmake .. at a workspace level folder and my builds would fail. After adding a CMakeLists.txt file to the workspace it works as intended.

MonJamp commented Nov 19, 2016

Looks like I hit a bug then, the workspace didn't have a CMakeLists.txt (maybe I accidentally deleted it). I noticed that CodeLite would try to run cmake .. at a workspace level folder and my builds would fail. After adding a CMakeLists.txt file to the workspace it works as intended.

@MonJamp MonJamp closed this Nov 19, 2016

@MonJamp

This comment has been minimized.

Show comment
Hide comment
@MonJamp

MonJamp Nov 19, 2016

Actually it seems as though CodeLite is not generating CMakeLists.txt when a workspace is made.

MonJamp commented Nov 19, 2016

Actually it seems as though CodeLite is not generating CMakeLists.txt when a workspace is made.

@MonJamp MonJamp reopened this Nov 19, 2016

@srini2174

This comment has been minimized.

Show comment
Hide comment
@srini2174

srini2174 Dec 9, 2016

Contributor

I agree with this suggestion from MonJamp. I have a scenario like the following.

  1. I created a workspace
  2. I added a new wxWidget GUI project (named testwxcrafter) with cmake build system
  3. I select the workspace->build workspace. ( I get the error The system cannot find the path specified - since the cmake-build-debug directory is not created).
  4. I select the project->Run CMAKE. Now the directory structure is created.
  5. I run workspace->build workspace. Now it gets compiled.
    case 2:
  6. I add a new wxwidget console project (named consoleApp) with cmake build system
  7. I run workspace->Rebuild workspace. I get the following message

----------Building project:[ consoleApp - Debug ]----------
The system cannot find the path specified.
====0 errors, 0 warnings====

  1. I select the project consoleApp -> Run CMake
  2. Now I select workspace->Rebuild workspace.
  3. Now only the consoleApp project gets compiled and the testwxcrafter project fails to compile with the following message.
    ----------Building project:[ testwxCrafter - Debug ]----------
    mingw32-make.exe[1]: *** No rule to make target 'testwxCrafter/all'. Stop.
    mingw32-make.exe: *** [all] Error 2
    Makefile:82: recipe for target 'all' failed
    ====1 errors, 0 warnings====

This happens because both the projects use the same output folder cmake-build-debug under the workspace. I was able to verify this by

  1. giving the CMAKE option -BconsoleApp in the Makefile Generator
  2. Run project->Run CMake on the consoleApp project
  3. Running workspace->Rebuild workspace is working fine
Contributor

srini2174 commented Dec 9, 2016

I agree with this suggestion from MonJamp. I have a scenario like the following.

  1. I created a workspace
  2. I added a new wxWidget GUI project (named testwxcrafter) with cmake build system
  3. I select the workspace->build workspace. ( I get the error The system cannot find the path specified - since the cmake-build-debug directory is not created).
  4. I select the project->Run CMAKE. Now the directory structure is created.
  5. I run workspace->build workspace. Now it gets compiled.
    case 2:
  6. I add a new wxwidget console project (named consoleApp) with cmake build system
  7. I run workspace->Rebuild workspace. I get the following message

----------Building project:[ consoleApp - Debug ]----------
The system cannot find the path specified.
====0 errors, 0 warnings====

  1. I select the project consoleApp -> Run CMake
  2. Now I select workspace->Rebuild workspace.
  3. Now only the consoleApp project gets compiled and the testwxcrafter project fails to compile with the following message.
    ----------Building project:[ testwxCrafter - Debug ]----------
    mingw32-make.exe[1]: *** No rule to make target 'testwxCrafter/all'. Stop.
    mingw32-make.exe: *** [all] Error 2
    Makefile:82: recipe for target 'all' failed
    ====1 errors, 0 warnings====

This happens because both the projects use the same output folder cmake-build-debug under the workspace. I was able to verify this by

  1. giving the CMAKE option -BconsoleApp in the Makefile Generator
  2. Run project->Run CMake on the consoleApp project
  3. Running workspace->Rebuild workspace is working fine
@min050820

This comment has been minimized.

Show comment
Hide comment
@min050820

min050820 Dec 17, 2016

I agree with this suggestion, too.

I have two projects, one being a library and the other one being a front-end for it. I build the library alone (to verify any errors) and then when I try to build the frontend, IDE builds the library instead.

I can verify that this happens because IDE uses the same directory, because when I delete the build directory (cmake-build-Debug), it works very well. (Note: I made sure to change the active project)

min050820 commented Dec 17, 2016

I agree with this suggestion, too.

I have two projects, one being a library and the other one being a front-end for it. I build the library alone (to verify any errors) and then when I try to build the frontend, IDE builds the library instead.

I can verify that this happens because IDE uses the same directory, because when I delete the build directory (cmake-build-Debug), it works very well. (Note: I made sure to change the active project)

@min050820

This comment has been minimized.

Show comment
Hide comment
@min050820

min050820 Dec 17, 2016

I have a showcase workspace to prove it. This workspace consists of two projects: library and executable. Even though the executable project is active, IDE still builds the library.
Steps to reproduce:

  1. Make a workspace of two projects
  2. Build one project (in this case, the first one) normally.
  3. Now, unless you manually delete 'cmake-build-Whatever' directory, IDE will build the first project regardless of what.
  4. Set active project, Run CMake nor Clean doesn't help it.

min050820 commented Dec 17, 2016

I have a showcase workspace to prove it. This workspace consists of two projects: library and executable. Even though the executable project is active, IDE still builds the library.
Steps to reproduce:

  1. Make a workspace of two projects
  2. Build one project (in this case, the first one) normally.
  3. Now, unless you manually delete 'cmake-build-Whatever' directory, IDE will build the first project regardless of what.
  4. Set active project, Run CMake nor Clean doesn't help it.
@eranif

This comment has been minimized.

Show comment
Hide comment
@eranif

eranif Jan 21, 2017

Owner

The CMake plugins uses the same concept as the default CodeLite build system: when you build a project, it will build it with all the dependencies defined by the user.
The dependencies are reflected in the workspace CMakeLists.txt file: it will contain list of add_subdirectory commands, one per project that the requested build project depends on.

Owner

eranif commented Jan 21, 2017

The CMake plugins uses the same concept as the default CodeLite build system: when you build a project, it will build it with all the dependencies defined by the user.
The dependencies are reflected in the workspace CMakeLists.txt file: it will contain list of add_subdirectory commands, one per project that the requested build project depends on.

@srini2174

This comment has been minimized.

Show comment
Hide comment
@srini2174

srini2174 Jan 21, 2017

Contributor

The add_subdirectory command is added only if a dependency is built using the "build order" command. If there is no dependency only the last project in which cmake is run is used. Everytime before running the build command I need to do a "Run CMAKE" command in order to build the correct project.

Contributor

srini2174 commented Jan 21, 2017

The add_subdirectory command is added only if a dependency is built using the "build order" command. If there is no dependency only the last project in which cmake is run is used. Everytime before running the build command I need to do a "Run CMAKE" command in order to build the correct project.

eranif added a commit that referenced this issue Jan 22, 2017

@eranif

This comment has been minimized.

Show comment
Hide comment
@eranif

eranif Jan 22, 2017

Owner

With my new commit, the CMake plugin will now create the following directory structure (assuming Debug configuration):

Workspace Folder +
                 + cmake-build-Debug
                             + Project One
                             + Project Two
                             + ...
                             + output

Where:

  • output - contains the binaries/libraries from all the various projects

You should be able to build all projects at once or alone without any issues.
There is no longer top level CMakeLists.txt file at top workspace folder, only a project generates CMakeLists.txt

Owner

eranif commented Jan 22, 2017

With my new commit, the CMake plugin will now create the following directory structure (assuming Debug configuration):

Workspace Folder +
                 + cmake-build-Debug
                             + Project One
                             + Project Two
                             + ...
                             + output

Where:

  • output - contains the binaries/libraries from all the various projects

You should be able to build all projects at once or alone without any issues.
There is no longer top level CMakeLists.txt file at top workspace folder, only a project generates CMakeLists.txt

@eranif eranif closed this Feb 2, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment