Browse Source

CMake: Move dtool_config.h to a configuration-specific dir

Sam Edwards 7 years ago
parent
commit
9c3841177b
2 changed files with 12 additions and 4 deletions
  1. 1 1
      CMakeLists.txt
  2. 11 3
      dtool/LocalSetup.cmake

+ 1 - 1
CMakeLists.txt

@@ -86,7 +86,7 @@ include(RunPzip)            # Defines run_pzip function
 include(Versioning)         # Hooks 'add_library' to apply VERSION/SOVERSION
 include(Versioning)         # Hooks 'add_library' to apply VERSION/SOVERSION
 
 
 # Add the include path for source and header files generated by CMake
 # Add the include path for source and header files generated by CMake
-include_directories("${PROJECT_BINARY_DIR}/include")
+include_directories("${PROJECT_BINARY_DIR}/include/${CMAKE_CFG_INTDIR}")
 
 
 # Determine which trees to build.
 # Determine which trees to build.
 option(BUILD_DTOOL  "Build the dtool source tree." ON)
 option(BUILD_DTOOL  "Build the dtool source tree." ON)

+ 11 - 3
dtool/LocalSetup.cmake

@@ -280,6 +280,14 @@ message("See dtool_config.h for more details about the specified configuration."
 message("")
 message("")
 
 
 # Generate dtool_config.h
 # Generate dtool_config.h
-configure_file(dtool_config.h.in "${PROJECT_BINARY_DIR}/include/dtool_config.h")
-include_directories("${PROJECT_BINARY_DIR}/include")
-#install(FILES "${PROJECT_BINARY_DIR}/dtool_config.h" DESTINATION include/panda3d)
+if("${CMAKE_CFG_INTDIR}" STREQUAL ".")
+  # Single-configuration generator
+  set(intdir ".")
+else()
+  # Multi-configuration generator
+  set(intdir "${CMAKE_BUILD_TYPE}")
+endif()
+
+configure_file(dtool_config.h.in "${PROJECT_BINARY_DIR}/include/${intdir}/dtool_config.h")
+install(FILES "${PROJECT_BINARY_DIR}/include/${intdir}/dtool_config.h"
+  DESTINATION include/panda3d)