Browse Source

CMake: Stop using include_directories()

Setting this directly on the target is cleaner,
and in most cases, the INTERFACE_INCLUDE_DIRECTORIES
mechanism takes care of it for us.
Sam Edwards 7 years ago
parent
commit
cf26888672

+ 0 - 3
cmake/macros/Interrogate.cmake

@@ -192,8 +192,6 @@ function(interrogate_sources target output database language_flags)
   # a JOIN will cause it to be escaped. Tabs are not escaped and will
   # a JOIN will cause it to be escaped. Tabs are not escaped and will
   # separate correctly.
   # separate correctly.
   set(include_flags "-I$<JOIN:$<TARGET_PROPERTY:${target}_igate_internal,INTERFACE_INCLUDE_DIRECTORIES>,\t-I>")
   set(include_flags "-I$<JOIN:$<TARGET_PROPERTY:${target}_igate_internal,INTERFACE_INCLUDE_DIRECTORIES>,\t-I>")
-  # The above must also be included when compiling the resulting _igate.cxx file:
-  include_directories("$<TARGET_PROPERTY:${target},INTERFACE_INCLUDE_DIRECTORIES>")
 
 
   # Get the compiler definition flags. These must be passed to Interrogate
   # Get the compiler definition flags. These must be passed to Interrogate
   # in the same way that they are passed to the compiler so that Interrogate
   # in the same way that they are passed to the compiler so that Interrogate
@@ -224,7 +222,6 @@ function(interrogate_sources target output database language_flags)
       ${IGATE_FLAGS}
       ${IGATE_FLAGS}
       ${language_flags}
       ${language_flags}
       ${define_flags}
       ${define_flags}
-      -S "${PROJECT_BINARY_DIR}/include"
       -S "${PROJECT_SOURCE_DIR}/dtool/src/interrogatedb"
       -S "${PROJECT_SOURCE_DIR}/dtool/src/interrogatedb"
       -S "${PROJECT_SOURCE_DIR}/dtool/src/parser-inc"
       -S "${PROJECT_SOURCE_DIR}/dtool/src/parser-inc"
       -S "${PYTHON_INCLUDE_DIRS}"
       -S "${PYTHON_INCLUDE_DIRS}"

+ 4 - 2
dtool/src/dtoolbase/CMakeLists.txt

@@ -85,8 +85,10 @@ composite_sources(p3dtoolbase P3DTOOLBASE_SOURCES)
 
 
 add_component_library(p3dtoolbase NOINIT SYMBOL BUILDING_DTOOL_DTOOLBASE
 add_component_library(p3dtoolbase NOINIT SYMBOL BUILDING_DTOOL_DTOOLBASE
   ${P3DTOOLBASE_HEADERS} ${P3DTOOLBASE_SOURCES})
   ${P3DTOOLBASE_HEADERS} ${P3DTOOLBASE_SOURCES})
-# Help other libraries find the autogenerated version headers
-target_include_directories(p3dtoolbase PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
+# Help other libraries find the autogenerated headers
+target_include_directories(p3dtoolbase PUBLIC
+  ${CMAKE_CURRENT_BINARY_DIR}
+  ${PROJECT_BINARY_DIR}/include/${CMAKE_CFG_INTDIR})
 target_use_packages(p3dtoolbase THREADS EIGEN)
 target_use_packages(p3dtoolbase THREADS EIGEN)
 target_interrogate(p3dtoolbase ${P3DTOOLBASE_SOURCES} EXTENSIONS ${P3DTOOLBASE_IGATEEXT})
 target_interrogate(p3dtoolbase ${P3DTOOLBASE_SOURCES} EXTENSIONS ${P3DTOOLBASE_IGATEEXT})
 
 

+ 0 - 10
panda/CMakeLists.txt

@@ -2,16 +2,6 @@ if(NOT BUILD_DTOOL)
   message(FATAL_ERROR "Cannot build panda without dtool!  Please enable the BUILD_DTOOL option.")
   message(FATAL_ERROR "Cannot build panda without dtool!  Please enable the BUILD_DTOOL option.")
 endif()
 endif()
 
 
-# Not sure where I want to hide these inludes yet, but it is annoying
-# to have to add them to every CMakeLists that either directly, or
-# recursively includes linmath, and other libraries etc...
-if(HAVE_CG)
-  include_directories(${CG_INCLUDE_DIRS})
-endif()
-if(HAVE_FREETYPE)
-  include_directories(${FREETYPE_INCLUDE_DIRS})
-endif()
-
 # Include panda source directories
 # Include panda source directories
 add_subdirectory(src/configfiles)
 add_subdirectory(src/configfiles)
 add_subdirectory(src/pandabase)
 add_subdirectory(src/pandabase)

+ 0 - 3
panda/src/audiotraits/CMakeLists.txt

@@ -21,7 +21,6 @@ if(HAVE_RAD_MSS)
       milesAudioSequence.cxx)
       milesAudioSequence.cxx)
 
 
   composite_sources(p3miles_audio P3MILES_SOURCES)
   composite_sources(p3miles_audio P3MILES_SOURCES)
-  include_directories(${MILES_INCLUDE_DIR})
   add_library(p3miles_audio ${P3MILES_HEADERS} ${P3MILES_SOURCES})
   add_library(p3miles_audio ${P3MILES_HEADERS} ${P3MILES_SOURCES})
   set_target_properties(p3miles_audio PROPERTIES DEFINE_SYMBOL BUILDING_MILES_AUDIO)
   set_target_properties(p3miles_audio PROPERTIES DEFINE_SYMBOL BUILDING_MILES_AUDIO)
   target_link_libraries(p3miles_audio panda)
   target_link_libraries(p3miles_audio panda)
@@ -40,7 +39,6 @@ if(HAVE_FMODEX)
       config_fmodAudio.cxx fmodAudioManager.cxx fmodAudioSound.cxx)
       config_fmodAudio.cxx fmodAudioManager.cxx fmodAudioSound.cxx)
 
 
   composite_sources(p3fmod_audio P3FMOD_SOURCES)
   composite_sources(p3fmod_audio P3FMOD_SOURCES)
-  include_directories(${FMODEX_INCLUDE_DIR})
   add_library(p3fmod_audio ${P3FMOD_HEADERS} ${P3FMOD_SOURCES})
   add_library(p3fmod_audio ${P3FMOD_HEADERS} ${P3FMOD_SOURCES})
   set_target_properties(p3fmod_audio PROPERTIES DEFINE_SYMBOL BUILDING_FMOD_AUDIO)
   set_target_properties(p3fmod_audio PROPERTIES DEFINE_SYMBOL BUILDING_FMOD_AUDIO)
   target_link_libraries(p3fmod_audio panda)
   target_link_libraries(p3fmod_audio panda)
@@ -60,7 +58,6 @@ if(HAVE_OPENAL)
 
 
 
 
   composite_sources(p3openal_audio P3OPENAL_SOURCES)
   composite_sources(p3openal_audio P3OPENAL_SOURCES)
-  include_directories(${OPENAL_INCLUDE_DIR})
   add_library(p3openal_audio ${P3OPENAL_HEADERS} ${P3OPENAL_SOURCES})
   add_library(p3openal_audio ${P3OPENAL_HEADERS} ${P3OPENAL_SOURCES})
   set_target_properties(p3openal_audio PROPERTIES DEFINE_SYMBOL BUILDING_OPENAL_AUDIO)
   set_target_properties(p3openal_audio PROPERTIES DEFINE_SYMBOL BUILDING_OPENAL_AUDIO)
   target_link_libraries(p3openal_audio panda)
   target_link_libraries(p3openal_audio panda)