correct includes and clang detection webgl
authorkoda
Fri, 09 Nov 2012 22:56:34 +0100
branchwebgl
changeset 8004 da4c6db6ea6b
parent 8001 379063958821
child 8006 7ca007615b88
correct includes and clang detection
project_files/hwc/CMakeLists.txt
project_files/hwc/rtl/CMakeLists.txt
--- a/project_files/hwc/CMakeLists.txt	Fri Nov 09 12:29:24 2012 -0500
+++ b/project_files/hwc/CMakeLists.txt	Fri Nov 09 22:56:34 2012 +0100
@@ -1,3 +1,24 @@
+
+if(CLANG)
+    set(clang_executable ${CLANG})
+else()
+    find_program(clang_executable clang)
+endif()
+
+if (clang_executable)
+    exec_program(${clang_executable} ARGS "-v" OUTPUT_VARIABLE clang_version_full)
+    string(REGEX MATCH "[0-9]+\\.[0-9]+" clang_version_long "${clang_version_full}")
+    string(REGEX REPLACE "([0-9]+\\.[0-9]+)" "\\1" clang_version "${clang_version_long}")
+    message(STATUS "Found CLANG: ${clang_executable} (version ${clang_version})")
+else()
+    message(FATAL_ERROR "No LLVM/Clang compiler found (required for engine_c target)")
+endif()
+
+
+find_package(GLEW REQUIRED)
+
+
+set(CMAKE_C_COMPILER ${clang_executable})
 
 configure_file(${hedgewars_SOURCE_DIR}/hedgewars/config.inc.in ${CMAKE_CURRENT_BINARY_DIR}/config.inc)
 
@@ -11,10 +32,9 @@
 
 add_subdirectory(rtl)
 
-find_package(GLEW REQUIRED)
-message("${GLEW_INCLUDE_PATH}")
+include_directories("${GLEW_INCLUDE_PATH}")
+include_directories(rtl)
 
-include_directories(rtl)
 file(GLOB engine_src *.c)
 add_executable(hwengine WIN32 ${engine_src})
 add_dependencies(hwengine engine_c fpcrtl)
--- a/project_files/hwc/rtl/CMakeLists.txt	Fri Nov 09 12:29:24 2012 -0500
+++ b/project_files/hwc/rtl/CMakeLists.txt	Fri Nov 09 22:56:34 2012 +0100
@@ -6,6 +6,8 @@
                 sysutils.c
 )
 
+include_directories(${GLEW_INCLUDE_PATH})
+
 add_library(fpcrtl ${fpcrtl_src})
 
 if(WEBGL)