Permalink
Browse files

Better CMake for Binary Validator + modules for PM and PMIniParser

  • Loading branch information...
1 parent 1797bd5 commit 0d77753a0ab97f4174bafdc2521f700becf70922 @massix committed May 12, 2012
Showing with 42 additions and 3 deletions.
  1. +2 −0 CMakeLists.txt
  2. +19 −0 cmake/Modules/FindPhantomMenace.cmake
  3. +17 −0 cmake/Modules/FindPmIniParser.cmake
  4. +4 −3 src/CMakeLists.txt
View
@@ -3,4 +3,6 @@
cmake_minimum_required(VERSION 2.0)
project(PMValidator)
+
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
add_subdirectory(src)
@@ -0,0 +1,19 @@
+# - Find PhantomMenace
+# Copyright (C) 2012 Massimo Gengarelli <massimo.gengarelli@gmail.com>
+
+FIND_PATH(PhantomMenace_INCLUDE_DIR
+ PM_Element.h
+ PM_GrammarElement.h
+ PM_ParsingEnvironment.h
+ PM_Validator.h)
+
+FIND_LIBRARY(PhantomMenace_LIBRARY
+ PhantomMenace)
+
+IF(PhantomMenace_INCLUDE_DIR AND PhantomMenace_LIBRARY)
+ MESSAGE(STATUS "Found PhantomMenace: ${PhantomMenace_LIBRARY}")
+ SET(PhantomMenace_FOUND TRUE)
+ELSE()
+ MESSAGE(STATUS "PhantomMenace not found")
+ SET(PhantomMenace_FOUND FALSE)
+ENDIF()
@@ -0,0 +1,17 @@
+# - Find PMIniParser
+# Copyright (C) 2012 Massimo Gengarelli <massimo.gengarelli@gmail.com>
+
+FIND_PATH(PmIniParser_INCLUDE_DIR
+ PM_IP_IniElement.h
+ PM_IP_Parser.h)
+
+FIND_LIBRARY(PmIniParser_LIBRARY
+ PmIniParser)
+
+IF(PmIniParser_INCLUDE_DIR AND PmIniParser_LIBRARY)
+ MESSAGE(STATUS "Found PmIniParser: ${PmIniParser_LIBRARY}")
+ SET(PmIniParser_FOUND TRUE)
+ELSE()
+ MESSAGE(STATUS "PmIniParser not found")
+ SET(PmIniParser_FOUND FALSE)
+ENDIF()
View
@@ -7,10 +7,11 @@ file(GLOB HEADERS ../include/*.h)
add_definitions(-Wall)
-link_directories(/usr/local/include)
-
+find_package(PhantomMenace REQUIRED)
add_executable(PhantomMenaceValidator ${SOURCES})
-target_link_libraries(PhantomMenaceValidator PhantomMenace)
+
+include_directories(${PhantomMenace_INCLUDE_DIR})
+target_link_libraries(PhantomMenaceValidator ${PhantomMenace_LIBRARY})
set_target_properties(PhantomMenaceValidator PROPERTIES VERSION 1.0.1)

0 comments on commit 0d77753

Please sign in to comment.