From 6e0ea02f17834cdd5ba8af9fcdad4f156ff1dafc Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Mon, 11 Aug 2014 20:24:16 +0200 Subject: [PATCH] Quoted all CMake paths with substitution. Fixes #258. --- CMakeLists.txt | 114 ++++++++++++++++++++-------------------- examples/CMakeLists.txt | 26 ++++----- src/CMakeLists.txt | 10 ++-- tests/CMakeLists.txt | 18 +++---- 4 files changed, 84 insertions(+), 84 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a74c9a4c..115c30a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,7 +61,7 @@ if (GLFW_USE_EGL) message(FATAL_ERROR "Unsupported client library") endif() - set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMake/modules) + set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMake/modules") find_package(EGL REQUIRED) if (NOT _GLFW_USE_OPENGL) @@ -200,8 +200,8 @@ if (_GLFW_WGL) set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} -lopengl32") - list(APPEND glfw_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR}) - list(APPEND glfw_LIBRARIES ${OPENGL_gl_LIBRARY}) + list(APPEND glfw_INCLUDE_DIRS "${OPENGL_INCLUDE_DIR}") + list(APPEND glfw_LIBRARIES "${OPENGL_gl_LIBRARY}") endif() #-------------------------------------------------------------------- @@ -214,10 +214,10 @@ if (_GLFW_X11) set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} x11") # Set up library and include paths - list(APPEND glfw_INCLUDE_DIRS ${X11_X11_INCLUDE_PATH}) - list(APPEND glfw_LIBRARIES ${X11_X11_LIB} ${CMAKE_THREAD_LIBS_INIT}) + list(APPEND glfw_INCLUDE_DIRS "${X11_X11_INCLUDE_PATH}") + list(APPEND glfw_LIBRARIES "${X11_X11_LIB}" "${CMAKE_THREAD_LIBS_INIT}") if (UNIX AND NOT APPLE) - list(APPEND glfw_LIBRARIES ${RT_LIBRARY}) + list(APPEND glfw_LIBRARIES "${RT_LIBRARY}") endif() # Check for XRandR (modern resolution switching and gamma control) @@ -225,8 +225,8 @@ if (_GLFW_X11) message(FATAL_ERROR "The RandR library and headers were not found") endif() - list(APPEND glfw_INCLUDE_DIRS ${X11_Xrandr_INCLUDE_PATH}) - list(APPEND glfw_LIBRARIES ${X11_Xrandr_LIB}) + list(APPEND glfw_INCLUDE_DIRS "${X11_Xrandr_INCLUDE_PATH}") + list(APPEND glfw_LIBRARIES "${X11_Xrandr_LIB}") set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} xrandr") # Check for XInput (high-resolution cursor motion) @@ -234,10 +234,10 @@ if (_GLFW_X11) message(FATAL_ERROR "The XInput library and headers were not found") endif() - list(APPEND glfw_INCLUDE_DIRS ${X11_Xinput_INCLUDE_PATH}) + list(APPEND glfw_INCLUDE_DIRS "${X11_Xinput_INCLUDE_PATH}") if (X11_Xinput_LIB) - list(APPEND glfw_LIBRARIES ${X11_Xinput_LIB}) + list(APPEND glfw_LIBRARIES "${X11_Xinput_LIB}") else() # Backwards compatibility (bug in CMake 2.8.7) list(APPEND glfw_LIBRARIES Xi) @@ -249,11 +249,11 @@ if (_GLFW_X11) message(FATAL_ERROR "The Xf86VidMode library and headers were not found") endif() - list(APPEND glfw_INCLUDE_DIRS ${X11_xf86vmode_INCLUDE_PATH}) + list(APPEND glfw_INCLUDE_DIRS "${X11_xf86vmode_INCLUDE_PATH}") set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} xxf86vm") if (X11_Xxf86vm_LIB) - list(APPEND glfw_LIBRARIES ${X11_Xxf86vm_LIB}) + list(APPEND glfw_LIBRARIES "${X11_Xxf86vm_LIB}") else() # Backwards compatibility (see CMake bug 0006976) list(APPEND glfw_LIBRARIES Xxf86vm) @@ -264,19 +264,19 @@ if (_GLFW_X11) message(FATAL_ERROR "The X keyboard extension headers were not found") endif() - list(APPEND glfw_INCLUDE_DIR ${X11_Xkb_INCLUDE_PATH}) + list(APPEND glfw_INCLUDE_DIR "${X11_Xkb_INCLUDE_PATH}") find_library(RT_LIBRARY rt) mark_as_advanced(RT_LIBRARY) if (RT_LIBRARY) - list(APPEND glfw_LIBRARIES ${RT_LIBRARY}) + list(APPEND glfw_LIBRARIES "${RT_LIBRARY}") set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} -lrt") endif() find_library(MATH_LIBRARY m) mark_as_advanced(MATH_LIBRARY) if (MATH_LIBRARY) - list(APPEND glfw_LIBRARIES ${MATH_LIBRARY}) + list(APPEND glfw_LIBRARIES "${MATH_LIBRARY}") set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} -lm") endif() @@ -285,8 +285,8 @@ if (_GLFW_X11) message(FATAL_ERROR "The Xcursor libraries and headers were not found") endif() - list(APPEND glfw_INCLUDE_DIR ${X11_Xcursor_INCLUDE_PATH}) - list(APPEND glfw_LIBRARIES ${X11_Xcursor_LIB}) + list(APPEND glfw_INCLUDE_DIR "${X11_Xcursor_INCLUDE_PATH}") + list(APPEND glfw_LIBRARIES "${X11_Xcursor_LIB}") set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} xcursor") endif() @@ -298,18 +298,18 @@ if (_GLFW_WAYLAND) find_package(Wayland REQUIRED) set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} wayland-egl") - list(APPEND glfw_INCLUDE_DIRS ${WAYLAND_INCLUDE_DIR}) - list(APPEND glfw_LIBRARIES ${WAYLAND_LIBRARIES} -pthread) + list(APPEND glfw_INCLUDE_DIRS "${WAYLAND_INCLUDE_DIR}") + list(APPEND glfw_LIBRARIES "${WAYLAND_LIBRARIES}" -pthread) find_package(XKBCommon REQUIRED) set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} xkbcommon") - list(APPEND glfw_INCLUDE_DIRS ${XKBCOMMON_INCLUDE_DIRS}) - list(APPEND glfw_LIBRARIES ${XKBCOMMON_LIBRARY}) + list(APPEND glfw_INCLUDE_DIRS "${XKBCOMMON_INCLUDE_DIRS}") + list(APPEND glfw_LIBRARIES "${XKBCOMMON_LIBRARY}") find_library(MATH_LIBRARY m) mark_as_advanced(MATH_LIBRARY) if (MATH_LIBRARY) - list(APPEND glfw_LIBRARIES ${MATH_LIBRARY}) + list(APPEND glfw_LIBRARIES "${MATH_LIBRARY}") set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} -lm") endif() endif() @@ -319,14 +319,14 @@ endif() #-------------------------------------------------------------------- if (_GLFW_GLX) - list(APPEND glfw_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR}) - list(APPEND glfw_LIBRARIES ${OPENGL_gl_LIBRARY}) + list(APPEND glfw_INCLUDE_DIRS "${OPENGL_INCLUDE_DIR}") + list(APPEND glfw_LIBRARIES "${OPENGL_gl_LIBRARY}") set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} gl") include(CheckFunctionExists) - set(CMAKE_REQUIRED_LIBRARIES ${OPENGL_gl_LIBRARY}) + set(CMAKE_REQUIRED_LIBRARIES "${OPENGL_gl_LIBRARY}") check_function_exists(glXGetProcAddress _GLFW_HAS_GLXGETPROCADDRESS) check_function_exists(glXGetProcAddressARB _GLFW_HAS_GLXGETPROCADDRESSARB) check_function_exists(glXGetProcAddressEXT _GLFW_HAS_GLXGETPROCADDRESSEXT) @@ -338,14 +338,14 @@ if (_GLFW_GLX) # Check for dlopen support as a fallback - set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_DL_LIBS}) + set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_DL_LIBS}") check_function_exists(dlopen _GLFW_HAS_DLOPEN) if (NOT _GLFW_HAS_DLOPEN) message(FATAL_ERROR "No entry point retrieval mechanism found") endif() if (CMAKE_DL_LIBS) - list(APPEND glfw_LIBRARIES ${CMAKE_DL_LIBS}) + list(APPEND glfw_LIBRARIES "${CMAKE_DL_LIBS}") set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} -l${CMAKE_DL_LIBS}") endif() endif() @@ -357,22 +357,22 @@ endif() #-------------------------------------------------------------------- if (_GLFW_EGL) - list(APPEND glfw_INCLUDE_DIRS ${EGL_INCLUDE_DIR}) - list(APPEND glfw_LIBRARIES ${EGL_LIBRARY}) + list(APPEND glfw_INCLUDE_DIRS "${EGL_INCLUDE_DIR}") + list(APPEND glfw_LIBRARIES "${EGL_LIBRARY}") set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} egl") if (_GLFW_USE_OPENGL) - list(APPEND glfw_LIBRARIES ${OPENGL_gl_LIBRARY}) - list(APPEND glfw_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR}) + list(APPEND glfw_LIBRARIES "${OPENGL_gl_LIBRARY}") + list(APPEND glfw_INCLUDE_DIRS "${OPENGL_INCLUDE_DIR}") set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} gl") elseif (_GLFW_USE_GLESV1) - list(APPEND glfw_LIBRARIES ${GLESv1_LIBRARY}) - list(APPEND glfw_INCLUDE_DIRS ${GLESv1_INCLUDE_DIR}) + list(APPEND glfw_LIBRARIES "${GLESv1_LIBRARY}") + list(APPEND glfw_INCLUDE_DIRS "${GLESv1_INCLUDE_DIR}") set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} glesv1_cm") elseif (_GLFW_USE_GLESV2) - list(APPEND glfw_LIBRARIES ${GLESv2_LIBRARY}) - list(APPEND glfw_INCLUDE_DIRS ${GLESv2_INCLUDE_DIR}) + list(APPEND glfw_LIBRARIES "${GLESv2_LIBRARY}") + list(APPEND glfw_INCLUDE_DIRS "${GLESv2_INCLUDE_DIR}") set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} glesv2") endif() @@ -407,11 +407,11 @@ if (_GLFW_COCOA AND _GLFW_NSGL) find_library(IOKIT_FRAMEWORK IOKit) find_library(CORE_FOUNDATION_FRAMEWORK CoreFoundation) find_library(CORE_VIDEO_FRAMEWORK CoreVideo) - list(APPEND glfw_LIBRARIES ${COCOA_FRAMEWORK} - ${OPENGL_gl_LIBRARY} - ${IOKIT_FRAMEWORK} - ${CORE_FOUNDATION_FRAMEWORK} - ${CORE_VIDEO_FRAMEWORK}) + list(APPEND glfw_LIBRARIES "${COCOA_FRAMEWORK}" + "${OPENGL_gl_LIBRARY}" + "${IOKIT_FRAMEWORK}" + "${CORE_FOUNDATION_FRAMEWORK}" + "${CORE_VIDEO_FRAMEWORK}") set(GLFW_PKG_DEPS "") set(GLFW_PKG_LIBS "-framework Cocoa -framework OpenGL -framework IOKit -framework CoreFoundation -framework CoreVideo") @@ -436,21 +436,21 @@ endif() # Create generated files #-------------------------------------------------------------------- if (GLFW_BUILD_DOCS) - configure_file(${GLFW_SOURCE_DIR}/docs/Doxyfile.in - ${GLFW_BINARY_DIR}/docs/Doxyfile @ONLY) + configure_file("${GLFW_SOURCE_DIR}/docs/Doxyfile.in" + "${GLFW_BINARY_DIR}/docs/Doxyfile" @ONLY) endif() -configure_file(${GLFW_SOURCE_DIR}/src/glfw_config.h.in - ${GLFW_BINARY_DIR}/src/glfw_config.h @ONLY) +configure_file("${GLFW_SOURCE_DIR}/src/glfw_config.h.in" + "${GLFW_BINARY_DIR}/src/glfw_config.h" @ONLY) -configure_file(${GLFW_SOURCE_DIR}/src/glfwConfig.cmake.in - ${GLFW_BINARY_DIR}/src/glfwConfig.cmake @ONLY) +configure_file("${GLFW_SOURCE_DIR}/src/glfwConfig.cmake.in" + "${GLFW_BINARY_DIR}/src/glfwConfig.cmake" @ONLY) -configure_file(${GLFW_SOURCE_DIR}/src/glfwConfigVersion.cmake.in - ${GLFW_BINARY_DIR}/src/glfwConfigVersion.cmake @ONLY) +configure_file("${GLFW_SOURCE_DIR}/src/glfwConfigVersion.cmake.in" + "${GLFW_BINARY_DIR}/src/glfwConfigVersion.cmake" @ONLY) -configure_file(${GLFW_SOURCE_DIR}/src/glfw3.pc.in - ${GLFW_BINARY_DIR}/src/glfw3.pc @ONLY) +configure_file("${GLFW_SOURCE_DIR}/src/glfw3.pc.in" + "${GLFW_BINARY_DIR}/src/glfw3.pc" @ONLY) #-------------------------------------------------------------------- # Add subdirectories @@ -477,22 +477,22 @@ if (GLFW_INSTALL) install(DIRECTORY include/GLFW DESTINATION include FILES_MATCHING PATTERN glfw3.h PATTERN glfw3native.h) - install(FILES ${GLFW_BINARY_DIR}/src/glfwConfig.cmake - ${GLFW_BINARY_DIR}/src/glfwConfigVersion.cmake + install(FILES "${GLFW_BINARY_DIR}/src/glfwConfig.cmake" + "${GLFW_BINARY_DIR}/src/glfwConfigVersion.cmake" DESTINATION lib${LIB_SUFFIX}/cmake/glfw) install(EXPORT glfwTargets DESTINATION lib${LIB_SUFFIX}/cmake/glfw) - install(FILES ${GLFW_BINARY_DIR}/src/glfw3.pc + install(FILES "${GLFW_BINARY_DIR}/src/glfw3.pc" DESTINATION lib${LIB_SUFFIX}/pkgconfig) # Only generate this target if no higher-level project already has if (NOT TARGET uninstall) - configure_file(${GLFW_SOURCE_DIR}/cmake_uninstall.cmake.in - ${GLFW_BINARY_DIR}/cmake_uninstall.cmake IMMEDIATE @ONLY) + configure_file("${GLFW_SOURCE_DIR}/cmake_uninstall.cmake.in" + "${GLFW_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY) add_custom_target(uninstall - ${CMAKE_COMMAND} -P - ${GLFW_BINARY_DIR}/cmake_uninstall.cmake) + "${CMAKE_COMMAND}" -P + "${GLFW_BINARY_DIR}/cmake_uninstall.cmake") endif() endif() diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index d89bd3e4..014ca943 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,27 +1,27 @@ -link_libraries(glfw ${OPENGL_glu_LIBRARY}) +link_libraries(glfw "${OPENGL_glu_LIBRARY}") if (BUILD_SHARED_LIBS) add_definitions(-DGLFW_DLL) - link_libraries(${OPENGL_gl_LIBRARY} ${MATH_LIBRARY}) + link_libraries("${OPENGL_gl_LIBRARY}" "${MATH_LIBRARY}") else() link_libraries(${glfw_LIBRARIES}) endif() -include_directories(${GLFW_SOURCE_DIR}/include - ${GLFW_SOURCE_DIR}/deps) +include_directories("${GLFW_SOURCE_DIR}/include" + "${GLFW_SOURCE_DIR}/deps") if (NOT APPLE) # HACK: This is NOTFOUND on OS X 10.8 - include_directories(${OPENGL_INCLUDE_DIR}) + include_directories("${OPENGL_INCLUDE_DIR}") endif() -set(GLAD ${GLFW_SOURCE_DIR}/deps/glad/glad.h - ${GLFW_SOURCE_DIR}/deps/glad.c) -set(GETOPT ${GLFW_SOURCE_DIR}/deps/getopt.h - ${GLFW_SOURCE_DIR}/deps/getopt.c) -set(TINYCTHREAD ${GLFW_SOURCE_DIR}/deps/tinycthread.h - ${GLFW_SOURCE_DIR}/deps/tinycthread.c) +set(GLAD "${GLFW_SOURCE_DIR}/deps/glad/glad.h" + "${GLFW_SOURCE_DIR}/deps/glad.c") +set(GETOPT "${GLFW_SOURCE_DIR}/deps/getopt.h" + "${GLFW_SOURCE_DIR}/deps/getopt.c") +set(TINYCTHREAD "${GLFW_SOURCE_DIR}/deps/tinycthread.h" + "${GLFW_SOURCE_DIR}/deps/tinycthread.c") if (APPLE) # Set fancy names for bundles @@ -50,9 +50,9 @@ else() endif() if (APPLE) - target_link_libraries(Particles ${CMAKE_THREAD_LIBS_INIT}) + target_link_libraries(Particles "${CMAKE_THREAD_LIBS_INIT}") elseif (UNIX) - target_link_libraries(particles ${CMAKE_THREAD_LIBS_INIT} ${RT_LIBRARY}) + target_link_libraries(particles "${CMAKE_THREAD_LIBS_INIT}" "${RT_LIBRARY}") endif() if (MSVC) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 66b4e9d8..6d94a4d0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,13 +1,13 @@ -include_directories(${GLFW_SOURCE_DIR}/src - ${GLFW_BINARY_DIR}/src +include_directories("${GLFW_SOURCE_DIR}/src" + "${GLFW_BINARY_DIR}/src" ${glfw_INCLUDE_DIRS}) add_definitions(-D_GLFW_USE_CONFIG_H) -set(common_HEADERS ${GLFW_BINARY_DIR}/src/glfw_config.h internal.h - ${GLFW_SOURCE_DIR}/include/GLFW/glfw3.h - ${GLFW_SOURCE_DIR}/include/GLFW/glfw3native.h) +set(common_HEADERS "${GLFW_BINARY_DIR}/src/glfw_config.h" internal.h + "${GLFW_SOURCE_DIR}/include/GLFW/glfw3.h" + "${GLFW_SOURCE_DIR}/include/GLFW/glfw3native.h") set(common_SOURCES clipboard.c context.c gamma.c init.c input.c joystick.c monitor.c time.c window.c) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index b7646f98..70e3ead5 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,5 +1,5 @@ -link_libraries(glfw ${OPENGL_glu_LIBRARY}) +link_libraries(glfw "${OPENGL_glu_LIBRARY}") if (BUILD_SHARED_LIBS) add_definitions(-DGLFW_DLL) @@ -8,18 +8,18 @@ else() link_libraries(${glfw_LIBRARIES}) endif() -include_directories(${GLFW_SOURCE_DIR}/include - ${GLFW_SOURCE_DIR}/deps) +include_directories("${GLFW_SOURCE_DIR}/include" + "${GLFW_SOURCE_DIR}/deps") if (NOT APPLE) # HACK: This is NOTFOUND on OS X 10.8 include_directories(${OPENGL_INCLUDE_DIR}) endif() -set(GETOPT ${GLFW_SOURCE_DIR}/deps/getopt.h - ${GLFW_SOURCE_DIR}/deps/getopt.c) -set(TINYCTHREAD ${GLFW_SOURCE_DIR}/deps/tinycthread.h - ${GLFW_SOURCE_DIR}/deps/tinycthread.c) +set(GETOPT "${GLFW_SOURCE_DIR}/deps/getopt.h" + "${GLFW_SOURCE_DIR}/deps/getopt.c") +set(TINYCTHREAD "${GLFW_SOURCE_DIR}/deps/tinycthread.h" + "${GLFW_SOURCE_DIR}/deps/tinycthread.c") add_executable(clipboard clipboard.c ${GETOPT}) add_executable(defaults defaults.c) @@ -58,8 +58,8 @@ set_target_properties(title PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Title") add_executable(windows WIN32 MACOSX_BUNDLE windows.c) set_target_properties(windows PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Windows") -target_link_libraries(empty ${CMAKE_THREAD_LIBS_INIT} ${RT_LIBRARY}) -target_link_libraries(threads ${CMAKE_THREAD_LIBS_INIT} ${RT_LIBRARY}) +target_link_libraries(empty "${CMAKE_THREAD_LIBS_INIT}" "${RT_LIBRARY}") +target_link_libraries(threads "${CMAKE_THREAD_LIBS_INIT}" "${RT_LIBRARY}") set(WINDOWS_BINARIES accuracy empty sharing tearing threads title windows cursoranim) set(CONSOLE_BINARIES clipboard defaults events fsaa gamma glfwinfo