Sysprogs forums › Forums › VisualGDB › Is it possible to export BSP compiler flags to global scope?
Tagged: cmake, compiler flags
- This topic has 4 replies, 2 voices, and was last updated 1 week, 4 days ago by
wtywtykk.
-
AuthorPosts
-
December 24, 2025 at 06:16 #37028
wtywtykk
ParticipantHi,
I’m using CMake based projects. Though VisualGDB has it’s own way to add libraries (add_bsp_based_executable and add_bsp_based_library), I sometimes need to use conventional libraries added by CMake native add_library. Since the compiler flags are not in global scope, I get VFP errors and ARM/Thumb mode errors. Also, for libraries that are purely algorithm, it’s not really good to use add_bsp_based_library because I need to pass the BSP name everywhere, and unused functions are added to the library.
So, Is it possible for you to add a CMake function like “export_bsp_compiler_flags_to_global(BSP)” to make the compiler flags visible to the whole project?
Regards.
December 24, 2025 at 08:28 #37029support
KeymasterHi,
VisualGDB uses the regular CMake for its projects. You can actually find the sources for the functions like add_bsp_based_library() in %VISUALGDB_DIR%\CMake\embedded.
The motivation behind using the add_bsp_based_executable() was to allow having multiple BSPs per project. A BSP defines compiler flags, include directories, etc., and every executable/library that uses that particular BSP automatically receives these flags.
If you absolutely want to override this mechanism and have your own global flags, you can easily add your own CMake functions either to the project’s CMake files, or to some shared files imported from the projects. E.g. you can see how add_bsp_based_executable() loads the BSP’s CFLAGS, and implement something similar.
December 25, 2025 at 06:15 #37030wtywtykk
ParticipantHi,
I looked through add_bsp_based_executable, but didn’t find the CFLAGS, seems it’s inheriting the CFLAGS from BSP by target_link_libraries. I don’t want to use target_link_libraries because it exposes many unrelated bsp files to my library.
So I looked into find_bsp, it’s using _core_cflags to pass the flags, but it seems the variable is private. I added the following lines after find_bsp. It’s not printing anything.
message(STATUS “_core_cflags = ${_core_cflags}”)
Any idea about that? I don’t fully understand what the bsp code is doing, correct me if I’m wrong.
December 25, 2025 at 08:55 #37031support
KeymasterHi,
VisualGDB’s CMake framework uses regular CMake commands. You can find a detailed reference of them here: https://cmake.org/cmake/help/latest/manual/cmake-commands.7.html.
That said, we had to handle a lot of corner cases to make sure everything works out-of-the-box, so if you would like to have your own parallel system, you will likely have to do a lot of research and troubleshooting.
January 11, 2026 at 04:46 #37050wtywtykk
ParticipantOk, my solution to this problem:
`get_target_property(BSP_COMPILE_OPTIONS BSP COMPILE_OPTIONS)
message(“Making compile flags global: ${BSP_COMPILE_OPTIONS}”)
add_compile_options(${BSP_COMPILE_OPTIONS})` -
AuthorPosts
- You must be logged in to reply to this topic.