Bladeren bron

Correctly select include directories

Daniele Bartolini 12 jaren geleden
bovenliggende
commit
6e7ea5ff5e
1 gewijzigde bestanden met toevoegingen van 20 en 11 verwijderingen
  1. 20 11
      CMakeLists.txt

+ 20 - 11
CMakeLists.txt

@@ -13,6 +13,7 @@ option (CROWN_BUILD_SAMPLES "Whether to build the samples" ON)
 option (CROWN_BUILD_TOOLS "Whether to build the tools" ON)
 option (CROWN_BUILD_TESTS "Whether to build unit tests" OFF)
 
+# platform independent includes
 set (INCLUDES
 	${CMAKE_SOURCE_DIR}/src
 	${CMAKE_SOURCE_DIR}/src/core
@@ -23,11 +24,8 @@ set (INCLUDES
 	${CMAKE_SOURCE_DIR}/src/core/compressors
 	${CMAKE_SOURCE_DIR}/src/core/streams
 	${CMAKE_SOURCE_DIR}/src/core/strings
-	${CMAKE_SOURCE_DIR}/src/core/threads
 	${CMAKE_SOURCE_DIR}/src/core/settings
 	${CMAKE_SOURCE_DIR}/src/os
-	${CMAKE_SOURCE_DIR}/src/os/posix
-	${CMAKE_SOURCE_DIR}/src/os/linux
 	${CMAKE_SOURCE_DIR}/src/input
 	${CMAKE_SOURCE_DIR}/src/renderers
 	${CMAKE_SOURCE_DIR}/src/network
@@ -52,26 +50,38 @@ set (CROWN_LUAJIT_LIBS
 	${CROWN_THIRD}/luajit/lib
 )
 
-include_directories(${INCLUDES} ${CROWN_LUAJIT_INCLUDES})
-link_directories(${CROWN_LUAJIT_LIBS})
-add_definitions(-pipe -ansi -W -Wall -Wextra -Wno-long-long -pedantic -fPIC -g -pg)
-
 # detect operating system
 if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
 	set(LINUX 1)
-	add_subdirectory(src/os/linux)
+	list(APPEND INCLUDES
+		${CMAKE_SOURCE_DIR}/src/os/posix
+		${CMAKE_SOURCE_DIR}/src/os/linux
+	)
 endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
 
 if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
-	set (WINDOWS 1)
-	add_subdirectory(src/os/win)
+	set(WINDOWS 1)
+	list(APPEND INCLUDES
+		${CMAKE_SOURCE_DIR}/src/os/win
+	)
 endif (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
 
+include_directories(${INCLUDES} ${CROWN_LUAJIT_INCLUDES})
+link_directories(${CROWN_LUAJIT_LIBS})
+add_definitions(-pipe -ansi -W -Wall -Wextra -Wno-long-long -pedantic -fPIC -g -pg)
 
 # add build directories
 add_subdirectory(src)
 add_subdirectory(${CROWN_THIRD})
 
+if (LINUX)
+	add_subdirectory(src/os/linux)
+endif (LINUX)
+
+if (WINDOWS)
+	add_subdirectory(src/os/win)
+endif (WINDOWS)
+
 if (CROWN_BUILD_OPENGL)
 	add_subdirectory(src/renderers/gl)
 endif (CROWN_BUILD_OPENGL)
@@ -92,4 +102,3 @@ if (CROWN_BUILD_TESTS)
 	add_subdirectory(tests)
 endif (CROWN_BUILD_TESTS)
 
-