[llvm] [cmake] Add possibility to use ChooseMSVCCRT.cmake when include LLVM library
[llvm-core.git] / include / llvm / Support / CMakeLists.txt
blob680be8fdf3911913c4c623845adc61748bbac4fd
1 find_first_existing_vc_file("${LLVM_MAIN_SRC_DIR}" llvm_vc)
3 # The VC revision include that we want to generate.
4 set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/VCSRevision.h")
6 set(generate_vcs_version_script "${LLVM_CMAKE_PATH}/GenerateVersionFromVCS.cmake")
8 if(llvm_vc AND LLVM_APPEND_VC_REV)
9   set(llvm_source_dir ${LLVM_MAIN_SRC_DIR})
10 endif()
12 # Create custom target to generate the VC revision include.
13 add_custom_command(OUTPUT "${version_inc}"
14   DEPENDS "${llvm_vc}" "${generate_vcs_version_script}"
15   COMMAND ${CMAKE_COMMAND} "-DNAMES=LLVM"
16                            "-DLLVM_SOURCE_DIR=${llvm_source_dir}"
17                            "-DHEADER_FILE=${version_inc}"
18                            -P "${generate_vcs_version_script}")
20 # Mark the generated header as being generated.
21 set_source_files_properties("${version_inc}"
22   PROPERTIES GENERATED TRUE
23              HEADER_FILE_ONLY TRUE)
25 add_custom_target(llvm_vcsrevision_h DEPENDS "${version_inc}")
26 set_target_properties(llvm_vcsrevision_h PROPERTIES FOLDER "Misc")