Skip to content

Conversation

@brccabral
Copy link

added cmake , and it can compile the examples and install as a lib

@Peter0x44
Copy link

Peter0x44 commented Apr 22, 2025

include("${CMAKE_CURRENT_LIST_DIR}/rlImGuiTargets.cmake")

What file is this referencing? it's not in the PR

CMakeLists.txt Outdated
endif ()


add_library(rlImGui STATIC)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this STATIC?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll work on the SHARED option, I'll get back to you in a couple of days.

@@ -0,0 +1,3 @@
@PACKAGE_INIT@

include("${CMAKE_CURRENT_LIST_DIR}/rlImGuiTargets.cmake")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What file does this reference? it's not in the PR.
Could you explain what the purpose of this file is?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Target files are created automatically by cmake on executing cmake --target install

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Files .cmake.in are templates. When we call cmake install cmake replaces @var@ with the value VAR from CMakeLists.txt and the result is what the consumer of the library will get after the installation.

)
target_link_libraries(imgui_style_example PRIVATE rlImGui)
add_custom_command(TARGET imgui_style_example POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer if this didn't copy files

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll remove them

@JeffM2501
Copy link
Contributor

I am not against having cmake as an option, but I have some concerns.

I don't use cmake, so I have concerns about maintenance, I would not want to have a build system that is not maintained.
I am also not a huge fan of the cmake files being spread out all over the project.
I have been thinking about updating the premake build system in rlImGui to be more like the one used in the quickstart, where all the premake files are contained to a single build folder. I would prefer a cmake system that was also constrained to a single folder.

@brccabral
Copy link
Author

Alright, valid concerns, it is probably better to cancel this PR then. What I did was enough for my project, I'll keep it on my fork only.

@JeffM2501
Copy link
Contributor

Alright, valid concerns, it is probably better to cancel this PR then. What I did was enough for my project, I'll keep it on my fork only.

can your system be modified to work from a single folder?

@brccabral
Copy link
Author

Yes. There are three files now, CMakeLists.txt in the root level for the library setup, a CMakeLists.txt for the examples and config.cmake.in.

The setup CMakeLists must be in the root level, the others I can move anywhere.

There is another possible solution to put everything in one single CMakeLists.txt. I prefer to have multiple files, I feel it keeps things organized, but it's your call.

  1. Three files in root
  2. Setup in root, other files in /cmake
  3. Setup and .in files in root, keep the /examples
  4. Everything in root CMakeLists.txt, no other file

@brccabral
Copy link
Author

I have made a new commit, one single CMakeLists.txt to handle all. static/shared, config, examples.

@JeffM2501
Copy link
Contributor

Yes. There are three files now, CMakeLists.txt in the root level for the library setup, a CMakeLists.txt for the examples and config.cmake.in.

The setup CMakeLists must be in the root level, the others I can move anywhere.

There is another possible solution to put everything in one single CMakeLists.txt. I prefer to have multiple files, I feel it keeps things organized, but it's your call.

  1. Three files in root
  2. Setup in root, other files in /cmake
  3. Setup and .in files in root, keep the /examples
  4. Everything in root CMakeLists.txt, no other file

Is there anyway to have noting in the root and everything in a cmake_build folder?

@brccabral
Copy link
Author

Unusual, I had to ask online but yes, it is possible. I'll review it some other time.

@brccabral
Copy link
Author

done, last commit has all in one file in /cmake folder

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants