-
-
Notifications
You must be signed in to change notification settings - Fork 814
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
Improve generated cmakelists #2410
Comments
set_target_properties(xtest PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/build/windows/x64/release") Add the build type prefix for debug release etc .. Example : set_target_properties(xtest PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_SOURCE_DIR}/build/windows/x64/release")
set_target_properties(xtest PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_SOURCE_DIR}/build/windows/x64/debug") Or remove it and let the user choose the output directory |
It is because that ADD_CUSTOM_COMMAND and PRE_BUILD did not work as I expected, so we need use add_dependencies and fake target to support it. see https://gitlab.kitware.com/cmake/cmake/-/issues/17802 xmake/xmake/plugins/project/cmake/cmakelists.lua Lines 693 to 708 in a9cc2ad
If you have a better solution to this problem, you can reduce 90% targets at least. |
We could use AUTOMOC at least for moc generation, and set AUTOMOC_EXECUTABLE so CMake doesn't have to find Qt by itself. |
AUTOMOC_PATH_PREFIX //
This breaks the paths in CLion because the output will be the same for all modes. For my use case i can just remove this generated line from the cmakelists, but if you need you can add those properties with the *_mode suffix |
I know there is a problem here, but supporting multiple mode switches at the same time would require a lot of code refactoring and a lot of detail consideration. So for the time being it is not supported. In addition, we need to be very careful with many cache-related issues. Currently, only the vs/vsxmake generators support them. If you are interested, you can also open a pr and refer to the vs generator to improve it. xmake/xmake/plugins/project/vstudio/impl/vs201x.lua Lines 519 to 597 in 95b9be3
|
What about removing RUNTIME_OUTPUT_DIRECTORY from the cmakelists as a hotfix then ? And let cmake use the default path, that's just two lines to comment. I don't know what people needs when generating cmakelists but for CLion, there is no problem using the default path, it will use the build dir which can be configured in CLion |
No, the generated output path must be exactly the same as the default configuration of xmake. All generators are consistent with xmake's output path. But you can modify output path in your xmake.lua by yourself. target("xxx")
set_targetdir("$(buildir)") |
I have improved it and reduced much custom command target in cmakelists on cxxmodules branch. |
I have merged it now. It should work. |
Is your feature request related to a problem? Please describe.
Huge size of generated cmakelists
Describe the solution you'd like
Reduce the size and the number of targets
Describe alternatives you've considered
I don't know what's the use case of people generating cmakelists but when using it in an IDE, the size and the number of generated targets can really slow the IDE.
I'm not sure to understand why you can't use automoc, the Qt path is supposed to be handled by xmake so you just need to pass the resolved path to the find_package and then use automoc.
Anyway you can still reduce the size by using 2 variables for cl et moc commands parameters and avoiding generating mocs for files not using q_object macro
Additional context
😢
Let me know what you prefer and i will try to hide those targets, maybe with EXCLUDE_FROM_ALL
The text was updated successfully, but these errors were encountered: