]> granicus.if.org Git - apache/commitdiff
CMake: use generator expressions to find output files
authorJacob Champion <jchampion@apache.org>
Tue, 12 Jul 2016 19:13:36 +0000 (19:13 +0000)
committerJacob Champion <jchampion@apache.org>
Tue, 12 Jul 2016 19:13:36 +0000 (19:13 +0000)
Multi-configuration generators, like Visual Studio, use a different
output directory (Debug, Release, etc.) for each configuration. To find
the output files reliably, switch to using generator expressions instead
of hardcoding the file paths for PDBs, export files, etc.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1752332 13f79535-47bb-0310-9956-ffa450edef68

CMakeLists.txt

index 9928fa0f2af92ea533e450a9c4eb8f98a562949c..fd81e91c1ca4a7f7a15da3bb73a827dec0ca9170 100644 (file)
@@ -765,12 +765,12 @@ FOREACH (mod ${MODULE_PATHS})
     SET(all_mod_sources ${tmp_mod_main_source} ${${mod_extra_sources}})
     ADD_LIBRARY(${mod_name} SHARED ${all_mod_sources} build/win32/httpd.rc)
     SET(install_modules ${install_modules} ${mod_name})
-    SET(install_modules_pdb ${install_modules_pdb} "${PROJECT_BINARY_DIR}/${mod_name}.pdb")
+    SET(install_modules_pdb ${install_modules_pdb} "$<TARGET_PDB_FILE:${mod_name}>")
     IF("${${mod_name}_install_lib}")
       SET(installed_mod_libs_exps
           ${installed_mod_libs_exps}
-          "${PROJECT_BINARY_DIR}/${mod_name}.lib"
-          "${PROJECT_BINARY_DIR}/${mod_name}.exp"
+          "$<TARGET_LINKER_FILE:${mod_name}>"
+          "$<TARGET_LINKER_FILE_DIR:${mod_name}>/${mod_name}.exp"
       )
     ENDIF()
     SET(mod_extra_libs "${mod_name}_extra_libs")
@@ -805,7 +805,7 @@ SET_TARGET_PROPERTIES(libhttpd PROPERTIES
   LINK_FLAGS /base:@${PROJECT_BINARY_DIR}/BaseAddr.ref,libhttpd.dll
 )
 SET(install_targets ${install_targets} libhttpd)
-SET(install_bin_pdb ${install_bin_pdb} ${PROJECT_BINARY_DIR}/libhttpd.pdb)
+SET(install_bin_pdb ${install_bin_pdb} $<TARGET_PDB_FILE:libhttpd>)
 TARGET_LINK_LIBRARIES(libhttpd ${EXTRA_LIBS} ${APR_LIBRARIES} ${PCRE_LIBRARIES} ${HTTPD_SYSTEM_LIBS})
 DEFINE_WITH_BLANKS(define_long_name "LONG_NAME" "Apache HTTP Server Core")
 SET_TARGET_PROPERTIES(libhttpd PROPERTIES COMPILE_FLAGS "-DAP_DECLARE_EXPORT -DAPREQ_DECLARE_EXPORT ${define_long_name} -DBIN_NAME=libhttpd.dll ${EXTRA_COMPILE_FLAGS}")
@@ -814,7 +814,7 @@ ADD_DEPENDENCIES(libhttpd test_char_header)
 ###########   HTTPD EXECUTABLES   ##########
 ADD_EXECUTABLE(httpd server/main.c build/win32/httpd.rc)
 SET(install_targets ${install_targets} httpd)
-SET(install_bin_pdb ${install_bin_pdb} ${PROJECT_BINARY_DIR}/httpd.pdb)
+SET(install_bin_pdb ${install_bin_pdb} $<TARGET_PDB_FILE:httpd>)
 DEFINE_WITH_BLANKS(define_long_name "LONG_NAME" "Apache HTTP Server")
 SET_TARGET_PROPERTIES(httpd PROPERTIES COMPILE_FLAGS "-DAPP_FILE ${define_long_name} -DBIN_NAME=httpd.exe -DICON_FILE=${CMAKE_SOURCE_DIR}/build/win32/apache.ico ${EXTRA_COMPILE_FLAGS}")
 TARGET_LINK_LIBRARIES(httpd libhttpd ${EXTRA_LIBS})
@@ -837,7 +837,7 @@ FOREACH(pgm ${standard_support})
   SET(extra_sources ${pgm}_extra_sources)
   ADD_EXECUTABLE(${pgm} support/${pgm}.c ${${extra_sources}} build/win32/httpd.rc)
   SET(install_targets ${install_targets} ${pgm})
-  SET(install_bin_pdb ${install_bin_pdb} ${PROJECT_BINARY_DIR}/${pgm}.pdb)
+  SET(install_bin_pdb ${install_bin_pdb} $<TARGET_PDB_FILE:${pgm}>)
   DEFINE_WITH_BLANKS(define_long_name "LONG_NAME" "Apache HTTP Server ${pgm} program")
   SET_TARGET_PROPERTIES(${pgm} PROPERTIES COMPILE_FLAGS "-DAPP_FILE ${define_long_name} -DBIN_NAME=${pgm}.exe ${EXTRA_COMPILE_FLAGS}")
   TARGET_LINK_LIBRARIES(${pgm} ${EXTRA_LIBS} ${APR_LIBRARIES})
@@ -846,7 +846,7 @@ ENDFOREACH()
 IF(OPENSSL_FOUND)
   ADD_EXECUTABLE(abs support/ab.c build/win32/httpd.rc)
   SET(install_targets ${install_targets} abs)
-  SET(install_bin_pdb ${install_bin_pdb} ${PROJECT_BINARY_DIR}/abs.pdb)
+  SET(install_bin_pdb ${install_bin_pdb} $<TARGET_PDB_FILE:abs>)
   SET_TARGET_PROPERTIES(abs PROPERTIES COMPILE_DEFINITIONS HAVE_OPENSSL)
   SET(tmp_includes ${HTTPD_INCLUDE_DIRECTORIES} ${OPENSSL_INCLUDE_DIR})
   SET_TARGET_PROPERTIES(abs PROPERTIES INCLUDE_DIRECTORIES "${tmp_includes}")
@@ -859,7 +859,7 @@ GET_PROPERTY(tmp_includes TARGET ab PROPERTY INCLUDE_DIRECTORIES)
 # getting duplicate manifest error with ApacheMonitor
 # ADD_EXECUTABLE(ApacheMonitor support/win32/ApacheMonitor.c support/win32/ApacheMonitor.rc)
 # SET(install_targets ${install_targets} ApacheMonitor)
-# SET(install_bin_pdb ${install_bin_pdb} ${PROJECT_BINARY_DIR}/ApacheMonitor.pdb)
+# SET(install_bin_pdb ${install_bin_pdb} $<TARGET_PDB_FILE:ApacheMonitor>)
 # SET_TARGET_PROPERTIES(ApacheMonitor PROPERTIES WIN32_EXECUTABLE TRUE)
 # SET_TARGET_PROPERTIES(ApacheMonitor PROPERTIES COMPILE_FLAGS "-DAPP_FILE -DLONG_NAME=ApacheMonitor -DBIN_NAME=ApacheMonitor.exe ${EXTRA_COMPILE_FLAGS}")
 # TARGET_LINK_LIBRARIES(ApacheMonitor ${EXTRA_LIBS} ${HTTPD_SYSTEM_LIBS} comctl32 wtsapi32)
@@ -916,7 +916,7 @@ INSTALL(DIRECTORY include/ DESTINATION include
 )
 INSTALL(FILES ${other_installed_h} DESTINATION include)
 INSTALL(FILES ${installed_mod_libs_exps} DESTINATION lib)
-INSTALL(FILES "${CMAKE_BINARY_DIR}/libhttpd.exp" DESTINATION LIB)
+INSTALL(FILES "$<TARGET_LINKER_FILE_DIR:libhttpd>/libhttpd.exp" DESTINATION LIB)
 INSTALL(FILES support/ctlogconfig DESTINATION bin)
 
 IF(INSTALL_MANUAL) # Silly?  This takes a while, and a dev doesn't need it.