From 4fcd4688a56cb35b29a0612a3fa05cf6beff62be Mon Sep 17 00:00:00 2001 From: Nigel Stewart Date: Thu, 19 Feb 2015 21:44:16 +1000 Subject: [PATCH] [cmake] Move cmake build into build/cmake to avoid collision with established GNUmake build system. --- .gitattributes | 7 ++++--- .gitignore | 4 ++++ CMakeLists.txt => build/cmake/CMakeLists.txt | 22 +++++++++++--------- 3 files changed, 20 insertions(+), 13 deletions(-) rename CMakeLists.txt => build/cmake/CMakeLists.txt (78%) diff --git a/.gitattributes b/.gitattributes index 56c8047..6bd6429 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,4 @@ -* text eol=lf -*.png binary -build/*/* text eol=crlf +* text eol=lf +*.png binary +build/*/* text eol=crlf +CMakeLists.txt text eol=lf diff --git a/.gitignore b/.gitignore index e182c2f..0cdd347 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,10 @@ /build/*/*.suo /build/*/*.vcxproj.user /build/*/tmp/ +/build/cmake/CMakeFiles/ +/build/cmake/CMakeCache.txt +/build/cmake/cmake_install.cmake +/build/cmake/Makefile /auto/extensions /auto/registry /bin diff --git a/CMakeLists.txt b/build/cmake/CMakeLists.txt similarity index 78% rename from CMakeLists.txt rename to build/cmake/CMakeLists.txt index e248a7f..4a1cbd6 100644 --- a/CMakeLists.txt +++ b/build/cmake/CMakeLists.txt @@ -14,6 +14,8 @@ option (BUILD_UTILS "utilities" ON) set (GLEW_VERSION "1.12.0") +set (GLEW_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../..) + set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) @@ -30,10 +32,10 @@ set (GLEW_LIBRARIES ${OPENGL_LIBRARIES}) add_definitions (-DGLEW_BUILD -DGLEW_NO_GLU) -include_directories (${PROJECT_SOURCE_DIR}/include) +include_directories (${GLEW_DIR}/include) -add_library (glew SHARED src/glew.c) -add_library (glew_s STATIC src/glew.c) +add_library (glew SHARED ${GLEW_DIR}/src/glew.c) +add_library (glew_s STATIC ${GLEW_DIR}/src/glew.c) target_link_libraries (glew ${GLEW_LIBRARIES}) target_link_libraries (glew_s ${GLEW_LIBRARIES}) set_target_properties (glew PROPERTIES OUTPUT_NAME ${GLEW_LIB_NAME}) @@ -41,8 +43,8 @@ set_target_properties (glew_s PROPERTIES OUTPUT_NAME ${GLEW_LIB_NAME}) set_target_properties (glew PROPERTIES PREFIX "${DLL_PREFIX}") set_target_properties (glew_s PROPERTIES PREFIX lib) -add_library(glewmx SHARED src/glew.c ) -add_library(glewmx_s STATIC src/glew.c ) +add_library(glewmx SHARED ${GLEW_DIR}/src/glew.c ) +add_library(glewmx_s STATIC ${GLEW_DIR}/src/glew.c ) target_link_libraries (glewmx ${GLEW_LIBRARIES}) target_link_libraries (glewmx_s ${GLEW_LIBRARIES}) set_target_properties (glewmx PROPERTIES COMPILE_FLAGS "-DGLEW_MX" OUTPUT_NAME ${GLEW_LIB_NAME}mx) @@ -57,10 +59,10 @@ install ( TARGETS glew glew_s glewmx glewmx_s ) if (BUILD_UTILS) - add_executable (glewinfo src/glewinfo.c) + add_executable (glewinfo ${GLEW_DIR}/src/glewinfo.c) target_link_libraries (glewinfo glew) - add_executable (visualinfo src/visualinfo.c) + add_executable (visualinfo ${GLEW_DIR}/src/visualinfo.c) target_link_libraries (visualinfo glew) install ( TARGETS glewinfo visualinfo @@ -76,11 +78,11 @@ set (version ${GLEW_VERSION}) set (libname ${GLEW_LIB_NAME}) set (cflags) set (requireslib glu) -configure_file (glew.pc.in ${CMAKE_BINARY_DIR}/glew.pc @ONLY) +configure_file (${GLEW_DIR}/glew.pc.in ${GLEW_DIR}/glew.pc @ONLY) set (cflags "-DGLEW_MX") set (libname ${GLEW_LIB_NAME}mx) -configure_file (glew.pc.in ${CMAKE_BINARY_DIR}/glewmx.pc @ONLY) +configure_file (${GLEW_DIR}/glew.pc.in ${GLEW_DIR}/glewmx.pc @ONLY) -install(FILES ${CMAKE_BINARY_DIR}/glew.pc ${CMAKE_BINARY_DIR}/glewmx.pc +install(FILES ${GLEW_DIR}/glew.pc ${GLEW_DIR}/glewmx.pc DESTINATION lib/pkgconfig )