我想将使用qmake(即this C++ project文件)进行构建的Tool.pro“移植”到cmake

本质上,我在问如何通过查看上面的CMakeLists.txt文件来编写必要的Tool.pro文件。

到目前为止,这是我所做的:

include_directories(../lib/cudd-2.5.0/include BFAbstractionLibrary)

add_executable(slugs BFAbstractionLibrary/bddDump.cpp BFAbstractionLibrary/BFCuddVarVector.cpp BFAbstractionLibrary/BFCudd.cpp BFAbstractionLibrary/BFCuddManager.cpp \
    BFAbstractionLibrary/BFCuddVarCube.cpp tools.cpp synthesisAlgorithm.cpp synthesisContextBasics.cpp variableManager.cpp \
    BFAbstractionLibrary/BFCuddMintermEnumerator.cpp)

add_library(lcudd ../lib/cudd-2.5.0/cudd)
add_library(ldddmp ../lib/cudd-2.5.0/dddmp)
add_library(lmtr ../lib/cudd-2.5.0/mtr)
add_library(lepd ../lib/cudd-2.5.0/epd)
add_library(lst ../lib/cudd-2.5.0/st)
add_library(lutil ../lib/cudd-2.5.0/util)

target_link_libraries(slugs lcudd, lutil, lmtr, lst, ldddmp, lepd)

绝对缺少Tool.pro文件中存在的 header 。我也不确定Tool.pro文件的前24行中的标志有什么关系。

你能指出我正确的方向吗?
  • PS1。我已经看过CMake教程。
  • PS2。我努力了
    两个脚本:q2cqmake2cmake。前者实质上
    空的CMakeLists.txt文件。后者建造了一个貌似还可以的
    文件,但是make失败,无法找到某些头文件(位于子目录中)。
  • PS3。我已经使用qmake成功构建了项目。
  • 最佳答案

    牺牲了上面Tool.pro文件的一些模块化和复杂性之后,我就可以使用cmake来构建项目。这是我编写的CMakeLists.txt文件:

    project( slugs )
    
    cmake_minimum_required( VERSION 2.6 )
    
    add_definitions ( -Wall )
    add_definitions ( -D USE_CUDD )
    
    set ( BDDFLAGS "-mtune=native -malign-double -DHAVE_IEEE_754 -DBSD -DCUDD_COMPILER_OPTIONS_SET" ) # hardcoded for x86_64
    add_definitions ( ${BDDFLAGS} )
    
    set ( CMAKE_BUILD_TYPE Debug )
    set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -std=gnu++0x -Wall -Wextra ${BDDFLAGS}")
    
    include_directories ( ../lib/cudd-2.5.0/include BFAbstractionLibrary )
    
    set ( slugs_HDRS
        BFAbstractionLibrary/BF.h
        BFAbstractionLibrary/BFCudd.h
        gr1context.hpp
        variableTypes.hpp
        variableManager.hpp
        extensionExtractExplicitStrategy.hpp
        extensionRoboticsSemantics.hpp
        extensionWeakenSafetyAssumptions.hpp
        extensionBiasForAction.hpp
        extensionComputeCNFFormOfTheSpecification.hpp
        extensionCounterstrategy.hpp
        extensionExtractExplicitCounterstrategy.hpp
        extensionIncrementalSynthesis.hpp
        extensionFixedPointRecycling.hpp
        extensionInteractiveStrategy.hpp
        extensionIROSfastslow.hpp
        extensionAnalyzeInitialPositions.hpp
        extensionAnalyzeAssumptions.hpp
        BFAbstractionLibrary/BFCuddMintermEnumerator.h
        extensionComputeInterestingRunOfTheSystem.hpp
        extensionAnalyzeSafetyLivenessInteraction.hpp
        extensionAbstractWinningTraceGenerator.hpp
        extensionInterleave.hpp
        extensionPermissiveExplicitStrategy.hpp
        extensionIncompleteInformationEstimatorSynthesis.hpp
        extensionNondeterministicMotion.hpp
        extensionExtractSymbolicStrategy.hpp
        extensionTwoDimensionalCost.hpp
        )
    
    set ( slugs_SRCS
        main.cpp
        BFAbstractionLibrary/bddDump.cpp
        BFAbstractionLibrary/BFCuddVarVector.cpp
        BFAbstractionLibrary/BFCudd.cpp
        BFAbstractionLibrary/BFCuddManager.cpp
        BFAbstractionLibrary/BFCuddVarCube.cpp
        tools.cpp
        synthesisAlgorithm.cpp
        synthesisContextBasics.cpp
        variableManager.cpp
        BFAbstractionLibrary/BFCuddMintermEnumerator.cpp
        )
    
    set ( slugs_LIBS
        -L../lib/cudd-2.5.0/cudd
        -L../lib/cudd-2.5.0/util
        -L../lib/cudd-2.5.0/mtr
        -L../lib/cudd-2.5.0/st
        -L../lib/cudd-2.5.0/dddmp
        -L../lib/cudd-2.5.0/epd
        -lcudd
        -ldddmp
        -lmtr
        -lepd
        -lst
        -lutil
        )
    
    add_executable ( slugs ${slugs_SRCS} )
    
    target_link_libraries (slugs ${slugs_LIBS})
    

    关于c++ - 如何将Qmake项目移植到cmake,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/28815024/

    10-12 20:37