Skip to content

Instantly share code, notes, and snippets.

@mikdusan
Created December 1, 2022 15:36
Show Gist options
  • Save mikdusan/b79f9f3e7600d292860c5d8abbc3b4c4 to your computer and use it in GitHub Desktop.
Save mikdusan/b79f9f3e7600d292860c5d8abbc3b4c4 to your computer and use it in GitHub Desktop.
CMakeLists.txt
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 015832913..5446b89fe 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -37,6 +37,10 @@ set(CMAKE_USER_MAKE_RULES_OVERRIDE
set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX
${CMAKE_CURRENT_SOURCE_DIR}/cmake/cxx_flag_overrides.cmake)
+message(STATUS "----------------- ${CMAKE_C_COMPILER}")
+file(TO_CMAKE_PATH ${CMAKE_C_COMPILER} CMAKE_C_COMPILER)
+message(STATUS "----------------- ${CMAKE_C_COMPILER}")
+
project(zig C CXX)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
@mikdusan
Copy link
Author

mikdusan commented Dec 1, 2022

  • note the above fixup of CMAKE_C_COMPILER must come before project()
  • on linux invoking with a backslashed gcc path...
cmake ... -DCMAKE_C_COMPILER='\usr\bin\gcc'

OUTPUT

-- ----------------- \usr\bin\gcc
-- ----------------- /usr/bin/gcc
-- The C compiler identification is GNU 12.2.0

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