Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use a custom cmake rule to find libconfig++

  • Loading branch information...
commit b432157c079b959a4ba05ce6fb2a54d672891714 1 parent c198d4e
@laudrup authored
Showing with 13 additions and 16 deletions.
  1. +5 −16 CMakeLists.txt
  2. +8 −0 cmake/FindLibConfig++.cmake
View
21 CMakeLists.txt
@@ -9,19 +9,7 @@ endif(NOT CMAKE_BUILD_TYPE)
# Set this to be a development build. Resources will be found relative to the source dir.
set(DEVELOPMENT_BUILD ON)
-include(FindPkgConfig)
-if(NOT PKG_CONFIG_FOUND)
- message(FATAL_ERROR "pkg-config not found")
-else(NOT PKG_CONFIG_FOUND)
- pkg_search_module(LIBCONFIGPP libconfig++)
- if(NOT LIBCONFIGPP_FOUND)
- set(LIBCONFIG_CXXFLAGS "" CACHE STRING "libconfig++ compiler flags")
- set(LIBCONFIG_LDFLAGS "" CACHE STRING "libconfig++ linker flags")
- else(NOT LIBCONFIGPP_FOUND)
- set(LIBCONFIG_CXXFLAGS ${LIBCONFIGPP_CFLAGS} CACHE STRING "libconfig++ compiler flags")
- set(LIBCONFIG_LDFLAGS ${LIBCONFIGPP_LDFLAGS} CACHE STRING "libconfig++ linker flags")
- endif(NOT LIBCONFIGPP_FOUND)
-endif(NOT PKG_CONFIG_FOUND)
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
find_package(SDL REQUIRED)
include_directories(${SDL_INCLUDE_DIR})
@@ -32,13 +20,14 @@ include_directories(${SDLIMAGE_INCLUDE_DIR})
find_package(SDL_ttf REQUIRED)
include_directories(${SDLTTF_INCLUDE_DIR})
+find_package(LibConfig++ REQUIRED)
+include_directories(${LIBCONFIG++_INCLUDE_DIR})
+
find_program(ETAGS NAMES etags etags.emacs)
# Extra flags for GCC
if(CMAKE_COMPILER_IS_GNUCC)
add_definitions(-Wall -Wextra -Wabi -Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder -Weffc++ -Wold-style-cast -Wsign-promo -Wcast-qual)
- set(CMAKE_CXX_FLAGS_DEBUG "-O0 -ggdb ${LIBCONFIG_CXXFLAGS}")
- set(CMAKE_CXX_FLAGS_RELEASE "-O3 -ggdb ${LIBCONFIG_CXXFLAGS}")
endif(CMAKE_COMPILER_IS_GNUCC)
include_directories(${CMAKE_BINARY_DIR}/)
@@ -73,7 +62,7 @@ link_libraries(
${SDL_LIBRARY}
${SDLIMAGE_LIBRARY}
${SDLTTF_LIBRARY}
- ${LIBCONFIG_LDFLAGS}
+ ${LIBCONFIG_LIBRARY}
)
add_executable(
View
8 cmake/FindLibConfig++.cmake
@@ -0,0 +1,8 @@
+# Find libconfig++
+
+find_path(LIBCONFIG++_INCLUDE_DIR libconfig.h++)
+find_library(LIBCONFIG++_LIBRARY config++)
+if (LIBCONFIG++_INCLUDE_DIR AND LIBCONFIG++_LIBRARY)
+ set(LIBCONFIG++_FOUND TRUE)
+endif (LIBCONFIG++_INCLUDE_DIR AND LIBCONFIG++_LIBRARY)
+
Please sign in to comment.
Something went wrong with that request. Please try again.