如何从其cmake文件中恢复丢失的源代码?

时间:2019-01-15 21:07:15

标签: c++ cmake

我不小心为几个月前开发的应用程序备份了错误版本的源代码。但是我能够恢复所有的Cmake文件和二进制文件。是否可以从Cmake生成的file.cc.o文件中取回我的源代码?知道许多库和标头也在使用中。

我尝试在编辑器中打开file.cc.o文件,但没有走运。我在该领域经验不足,所以我真的不知道是否有可能。但是我肯定会这样,因为我有预编译文件。

这是我用来生成所有内容的cmakelists.txt

# $Id: CMakeLists.txt 86065 2014-11-07 08:51:15Z gcosmo $

#----------------------------------------------------------------------------
# Setup the project
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
project(box)

#----------------------------------------------------------------------------
# Find Geant4 package, activating all available UI and Vis drivers by default
# to build a batch mode only executable
#
option(WITH_GEANT4_UIVIS "Build a box with Geant4 UI and Vis drivers" ON)
if(WITH_GEANT4_UIVIS)
  find_package(Geant4 REQUIRED ui_all vis_all)
else()
  find_package(Geant4 REQUIRED)
endif()

#----------------------------------------------------------------------------
# Setup Geant4 include directories and compile definitions
# Setup include directory for this project
#
include(${Geant4_USE_FILE})
include_directories(${PROJECT_SOURCE_DIR}/include)


#----------------------------------------------------------------------------
# Locate sources and headers for this project
# NB: headers are included so they will show up in IDEs
#
file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)


# Add the executable, and link it to the Geant4 libraries
#
add_executable(Neutron_Detector neutron_detector.cc ${sources} ${headers})
target_link_libraries(Neutron_Detector ${Geant4_LIBRARIES})


# Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
#
install(TARGETS Neutron_Detector DESTINATION bin)

0 个答案:

没有答案