You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If used as child CMake directory, parent CXXFLAGS_DEBUG etc are forcibly cleared in parent CMakeCache.txt on MacOS (and probably any platform but MSVC)
#54
Closed
bradgrantham opened this issue
Mar 18, 2021
· 0 comments
MiniFB is great, and I'm happy to have it! I'm using minifb as a submodule in my project using add_subdirectory() in my CMakeLists.txt.
I think that the lines in CMakeLists.txt in f66e92c between 121 and 135 of the form set(CMAKE_... "" CACHE STRING "" FORCE) are forcing the system CMAKE_... variables to be overwritten in CMakeCache.txt. E.g. A line CMAKE_CXX_FLAGS_DEBUG:STRING= is emitted into my CMakeCache.txt. These variables are therefore overwritten for my project, and, if I understand CMake correctly, for every other subdirectory which doesn't explicitly set them.
But I expect CMAKE_CXX_FLAGS_DEBUG:STRING=-g. If I compile my project with -DCMAKE_BUILD_TYPE=Debug, none of my project code is compiled debug, and I have no symbols in my executable and can't do any symbolic debugging with lldb. Additionally my environment CXX_FLAGS is ignored (in which I have "-Wall")
If I remove CACHE STRING "" FORCE from those lines, my code compiles Debug just fine (and my environment CXX_FLAGS are honored, which had been missing up to this point) and MiniFB still clears the system compile flags and gets its custom build flags specified at 139 and 140.
Is it possible you don't want to set those variables in the cache at all?
The text was updated successfully, but these errors were encountered:
MiniFB is great, and I'm happy to have it! I'm using minifb as a submodule in my project using add_subdirectory() in my CMakeLists.txt.
I think that the lines in CMakeLists.txt in f66e92c between 121 and 135 of the form
set(CMAKE_... "" CACHE STRING "" FORCE)
are forcing the system CMAKE_... variables to be overwritten in CMakeCache.txt. E.g. A lineCMAKE_CXX_FLAGS_DEBUG:STRING=
is emitted into my CMakeCache.txt. These variables are therefore overwritten for my project, and, if I understand CMake correctly, for every other subdirectory which doesn't explicitly set them.But I expect
CMAKE_CXX_FLAGS_DEBUG:STRING=-g
. If I compile my project with -DCMAKE_BUILD_TYPE=Debug, none of my project code is compiled debug, and I have no symbols in my executable and can't do any symbolic debugging with lldb. Additionally my environment CXX_FLAGS is ignored (in which I have "-Wall")If I remove
CACHE STRING "" FORCE
from those lines, my code compiles Debug just fine (and my environment CXX_FLAGS are honored, which had been missing up to this point) and MiniFB still clears the system compile flags and gets its custom build flags specified at 139 and 140.Is it possible you don't want to set those variables in the cache at all?
The text was updated successfully, but these errors were encountered: