Ver código fonte

CMake: Fixed building tools when the Boost headers are not in the default include path; fixed pkg-config file installation for out-of-source builds.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@802 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
klickverbot 15 anos atrás
pai
commit
b0196db29f
1 arquivos alterados com 23 adições e 4 exclusões
  1. 23 4
      CMakeLists.txt

+ 23 - 4
CMakeLists.txt

@@ -21,14 +21,33 @@ SET( INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH
 SET( BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH
 	"Path the tool executables are installed to." )
 
-CONFIGURE_FILE (assimp.pc.in assimp.pc @ONLY )
-INSTALL( FILES assimp.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig/ )
+# Generate a pkg-config .pc for the Assimp library.
+CONFIGURE_FILE( "${CMAKE_SOURCE_DIR}/assimp.pc.in" "${CMAKE_BINARY_DIR}/assimp.pc" @ONLY )
+INSTALL( FILES "${CMAKE_BINARY_DIR}/assimp.pc" DESTINATION ${LIB_INSTALL_DIR}/pkgconfig/ )
+
+# Globally enbale Boost resp. the Boost workaround – it is also needed by the
+# tools which include the Assimp headers.
+IF ( ENABLE_BOOST_WORKAROUND )
+	INCLUDE_DIRECTORIES( BoostWorkaround )
+	ADD_DEFINITIONS( -DASSIMP_BUILD_BOOST_WORKAROUND )
+	MESSAGE( STATUS "Building a non-boost version of Assimp." )
+ELSE ( ENABLE_BOOST_WORKAROUND )
+	FIND_PACKAGE( Boost 1.35 )
+
+	IF ( NOT Boost_FOUND )
+		MESSAGE( FATAL_ERROR
+			"Boost libraries (http://www.boost.org/) not found. "
+			"You can build a non-boost version of Assimp with slightly reduced "
+			"functionality by specifying -DENABLE_BOOST_WORKAROUND=ON."
+		)
+	ENDIF ( NOT Boost_FOUND )
+
+	INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIRS} )
+ENDIF ( ENABLE_BOOST_WORKAROUND )
 
-# Libs
 ADD_SUBDIRECTORY( code/ )
 IF ( WIN32 )
 	ADD_SUBDIRECTORY( test/ )
 	ADD_SUBDIRECTORY( tools/assimp_view/ )
 ENDIF ( WIN32 )
-
 ADD_SUBDIRECTORY( tools/assimp_cmd/ )