-
Notifications
You must be signed in to change notification settings - Fork 354
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
missing CMAKE_BUILD_TYPE when using Visual Studio to build #932
Comments
append "-DCMAKE_BUILD_TYPE=Release" to the cmake command line will solve the issue. |
The variable is definitely not missing. https://github.com/libgeos/geos/blob/main/CMakeLists.txt#L115-L121 Seems odd that the attempt to set the cache values is failing. The error message says the cache "has not yet been created" I wonder if the use of set() is the problem and there's something special to be done for cache variables. |
This is now a frowned upon practice given that its caching will interact poorly with an IDE that's doing multiple build types. I suspect that's what's going on here. GEOS should consider removing this and let default CMake machinery for CMAKE_BUILD_TYPE drive what happens. |
Maybe guard it behind |
Completely reasonable. |
Can you do that @dbaston, I'm not 100% clear on what to guard where, while still addressing the core problem in this issue and without altering behaviour somewhere else. hashtag-jenga-blocks |
I was thinking about this: dbaston@a28090c though I haven't tried reproducing the issue reported here to see if that change resolves it. |
Does not work on my side.
|
@dbaston the CMake error is on the following line:
Since
I can't speak for all distributions, but I know that Arch Linux prefers to use the CMake default configuration and uses As a consumer of the GEOS library, this puts us in an extremely bad situation:
In other words, we don't have one version that can build on all the platforms we use... |
Do you have a PR we can test? |
I can see about pushing something up. Another thing worth noting: on Windows, C++ libraries built in Release aren't compatible with other libraries or executables built in Debug, and vice-versa. This is because Debug builds will have extra debugging functionality enabled for the STL and can cause crashes if there's a mismatch between debugging being enabled or disabled. (the ABIs are incompatible) I mention this because with the current where |
Avoid setting CMAKE_BUILD_TYPE default when multi-config generators are used. Avoid setting CMAKE_BUILD_TYPE STRINGS property if it is not a cache variable. This avoids CMake errors if CMAKE_BUILD_TYPE isn't set on the command-line. Closes libgeos#932
@pramsey I created #945 to fix the issue. I incorporated the change from @dbaston to avoid setting |
Avoid setting CMAKE_BUILD_TYPE default when multi-config generators are used. Avoid setting CMAKE_BUILD_TYPE STRINGS property if it is not a cache variable. This avoids CMake errors if CMAKE_BUILD_TYPE isn't set on the command-line. Closes #932
Platform: Windows 11 Pro, Visual Studio 2022
cmake -S . -B _build_vs2022x64 -G "Visual Studio 17 2022" -A x64 -DCMAKE_GENERATOR_TOOLSET=host=x64
-- The C compiler identification is MSVC 19.36.32532.0
-- The CXX compiler identification is MSVC 19.36.32532.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.36.32532/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.36.32532/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- GEOS: Version 3.13.0dev
-- GEOS: C API Version 1.18.0
-- GEOS: JTS port 1.18.0
-- GEOS: Using default build type: Release
-- GEOS: Run-time output: C:/Users/sangs/source/repos/geos.sangshuduo/_build_vs2022x64/bin
-- GEOS: Archives output: C:/Users/sangs/source/repos/geos.sangshuduo/_build_vs2022x64/lib
CMake Error at CMakeLists.txt:189 (set_property):
set_property could not find CACHE variable CMAKE_BUILD_TYPE. Perhaps it
has not yet been created.
-- GEOS: Require C++14
-- GEOS: Developer mode ENABLED
-- Looking for pow in m
-- Looking for pow in m - not found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
-- Found Threads: TRUE
-- GEOS: Build geosop ON
-- GEOS: install runtime path for util: $ORIGIN/../lib
-- GEOS: Build astyle OFF
-- Configuring incomplete, errors occurred!
The text was updated successfully, but these errors were encountered: