diff options
author | Brad King <brad.king@kitware.com> | 2012-09-25 18:29:41 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2012-09-25 19:23:35 (GMT) |
commit | b294457e2b96f40d01a22b867666277495977fa8 (patch) | |
tree | 814a3727937cb809226947f2fdc97e6a9a368e70 /Tests/PDBDirectoryAndName | |
parent | 3f60dbf1484575f4c28a15c89e1af071648c8f2d (diff) | |
download | CMake-b294457e2b96f40d01a22b867666277495977fa8.zip CMake-b294457e2b96f40d01a22b867666277495977fa8.tar.gz CMake-b294457e2b96f40d01a22b867666277495977fa8.tar.bz2 |
Verify that PDB_(NAME|OUTPUT_DIRECTORY) are honored in test
Teach the PDBDirectoryAndName test to check that the .pdb files appear
where expected.
Diffstat (limited to 'Tests/PDBDirectoryAndName')
-rw-r--r-- | Tests/PDBDirectoryAndName/CMakeLists.txt | 26 | ||||
-rw-r--r-- | Tests/PDBDirectoryAndName/check_pdbs.cmake | 10 |
2 files changed, 36 insertions, 0 deletions
diff --git a/Tests/PDBDirectoryAndName/CMakeLists.txt b/Tests/PDBDirectoryAndName/CMakeLists.txt index ef1cae1..a9d46ca 100644 --- a/Tests/PDBDirectoryAndName/CMakeLists.txt +++ b/Tests/PDBDirectoryAndName/CMakeLists.txt @@ -5,33 +5,40 @@ if(NOT MSVC) MESSAGE(FATAL_ERROR "The PDB file test works only with MSVC") endif() +set(my_targets "") + add_library(mylibA SHARED mylibA.c) set_target_properties(mylibA PROPERTIES PDB_NAME "mylibA_Special" PDB_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/mylibA_PDB" ) +list(APPEND my_targets mylibA) add_library(mylibB STATIC mylibB.c) set_target_properties(mylibB PROPERTIES PDB_NAME "mylibB_Special" PDB_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/mylibB_PDB" ) +list(APPEND my_targets mylibB) add_library(mylibC SHARED mylibC.c) set_target_properties(mylibC PROPERTIES PDB_NAME "mylibC_Special" ) +list(APPEND my_targets mylibC) add_library(mylibD STATIC mylibD.c) set_target_properties(mylibD PROPERTIES PDB_NAME "mylibD_Special" ) +list(APPEND my_targets mylibD) add_executable(myexe myexe.c) set_target_properties(myexe PROPERTIES PDB_NAME "myexe_Special" PDB_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/myexe_PDB" ) +list(APPEND my_targets myexe) target_link_libraries(myexe mylibA mylibB mylibC mylibD) @@ -39,5 +46,24 @@ add_executable(myexe2 myexe2.c) set_target_properties(myexe2 PROPERTIES PDB_NAME "myexe2_Special" ) +list(APPEND my_targets myexe2) target_link_libraries(myexe2 mylibA mylibD) + +#----------------------------------------------------------------------------- +# Check that PDB files actually appear where expected. + +set(pdbs "") +foreach(t ${my_targets}) + get_property(pdb_name TARGET ${t} PROPERTY PDB_NAME) + get_property(pdb_dir TARGET ${t} PROPERTY PDB_OUTPUT_DIRECTORY) + if(NOT pdb_dir) + set(pdb_dir ${CMAKE_CURRENT_BINARY_DIR}) + endif() + list(APPEND pdbs ${pdb_dir}/${CMAKE_CFG_INTDIR}/${pdb_name}.pdb) +endforeach() +add_custom_target(check_pdbs ALL VERBATIM + COMMAND ${CMAKE_COMMAND} -Dconfig=$<CONFIGURATION> "-Dpdbs=${pdbs}" + -P ${CMAKE_CURRENT_SOURCE_DIR}/check_pdbs.cmake + ) +add_dependencies(check_pdbs ${my_targets}) diff --git a/Tests/PDBDirectoryAndName/check_pdbs.cmake b/Tests/PDBDirectoryAndName/check_pdbs.cmake new file mode 100644 index 0000000..89cdb3c --- /dev/null +++ b/Tests/PDBDirectoryAndName/check_pdbs.cmake @@ -0,0 +1,10 @@ +if(NOT "${config}" MATCHES "[Dd][Ee][Bb]") + return() +endif() +foreach(pdb ${pdbs}) + if(EXISTS "${pdb}") + message(STATUS "PDB Exists: ${pdb}") + else() + message(SEND_ERROR "PDB MISSING: ${pdb}") + endif() +endforeach() |