ExternalProject_Add初始svn co未执行

时间:2015-11-27 10:21:47

标签: svn cmake svn-checkout

更新最小工作示例

我在公共svn repo中创建了一个最小的工作示例。 Checkout来自trunk的proj文件夹,它有一个CMakeLists.txt和main.cpp(下面的代码已发布)。在trunk中我还有lib文件夹,它是实现类的静态库。这个类在我的主要使用。我在代理服务器后面,所以我在~/.subversion/server添加了全局代理设置。

预期行为:结帐项目后,执行cmake .并执行结帐 lib 并执行{{1}在构建我的make之前创建libmylib.a。最后main我的主要项目。

实际行为:不结帐 lib ,因此未构建make。错误讯息:

libmylib.a

文件夹由Re-run cmake no build system arguments -- Found Subversion: /usr/bin/svn (found version "1.8.8") -- The C compiler identification is GNU 4.8.4 -- The CXX compiler identification is GNU 4.8.4 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Configuring done CMake Error at CMakeLists.txt:48 (add_executable): Cannot find source file: /home/user/tmp/externalProject_Test/trunk/proj/project_mylib/lib/mylib.hpp Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx -- Build files have been written to: /home/user/tmp/externalProject_Test/trunk/proj 生成,但ExternalProject_add

中没有svn co

MWE main.cpp:

trunk/proj/project_mylib/lib

的CMakeLists.txt:

#include "project_mylib/lib/mylib.hpp"
int main () {
  Talker me; 
  me.say(); 
  return 0;
}

mylib.cpp:

cmake_minimum_required(VERSION 2.8.3)

### Try to add external project 
include(ExternalProject)
ExternalProject_Add(project_mylib
    PREFIX project_mylib 
    SVN_REPOSITORY "https://subversion.assembla.com/svn/eternapprojectmwe/trunk/lib/"
#   SVN_REVISION ""         
#   SVN_USERNAME "" 
#   SVN_PASSWORD ""
    SVN_TRUST_CERT 1  
    TIMEOUT 30
    UPDATE_COMMAND ""
    SOURCE_DIR "project_mylib/lib"
    CONFIGURE_COMMAND ""
    BINARY_DIR "project_mylib/lib"
    BUILD_COMMAND  make
    BUILD_IN_SOURCE 
    INSTALL_COMMAND ""
)
ExternalProject_Get_Property(project_mylib binary_dir) 
project(main)
SET(LIB_DIR ${binary_dir})
SET(SOURCES ${PROJECT_SOURCE_DIR}/main.cpp)
SET(HEADERS ${LIB_DIR}/mylib.hpp)
add_custom_command(TARGET project_mylib
        POST_BUILD
        COMMAND echo ${LIB_DIR}
)
include_directories(
    include
    ${LIB_DIR}  
)
add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS} ${LIB_DIR}) 
add_dependencies(${PROJECT_NAME} project_mylib) 
target_link_libraries(${PROJECT_NAME} ${LIB_DIR}/libmylib.a)

mylib.hpp

#include "mylib.hpp"
 Talker::Talker()
{
    this->text = "Hello!";
}
 bool Talker::say(void)
{
    cout << this->text;
    return true;    
}

静态库的Makefile

#include <iostream>
#include <string>
using namespace std;
class Talker {
   string text;
  public:
    Talker();
    bool say(void);
};

原帖

我有# Specify extensions of files to delete when cleaning CLEANEXTS = o a # Specify the target file and the install directory OUTPUTFILE = libmylib.a INSTALLDIR = . # Default target .PHONY: all all: $(OUTPUTFILE) # Build libjohnpaul.a from john.o, paul.o, and johnpaul.o $(OUTPUTFILE): mylib.o ar ru $@ $^ ranlib $@ # No rule to build john.o, paul.o, and johnpaul.o from .cpp # files is required; this is handled by make's database of # implicit rules .PHONY: install install: mkdir -p $(INSTALLDIR) cp -p $(OUTPUTFILE) $(INSTALLDIR) .PHONY: clean clean: for file in $(CLEANEXTS); do rm -f *.$$file; done # Indicate dependencies of .ccp files on .hpp files mylib.o: mylib.hpp 个包( pomdp_planner )与ROS项目( project_appl )相关联。我在我们的Makefiel但是不同的位置(我在代理服务器后面)有两个项目。如果我重新检查ROS节点并构建它,则无法下载SVN项目,因此在链接阶段构建失败。如果我在所需的位置手动签出Makefile项目,那么构建ROS PKG

我的问题是Makefile中的Makefile项目没有更新到SVN上的当前版本,甚至在开始时都没有检出。要构建ROS pkg,我使用externalproject_add()

我正在研究catkin_tools 14.04,Ubuntu 2.8.12.2(以及ROS Indigo)。

My ROS pkg CMakeList:

cmake

1 个答案:

答案 0 :(得分:1)

您的配置看起来很好,CMakeLists.txt中似乎出现了一个小错误:项目(主要)应该出现在外部项目包含部分之前。希望这会有所帮助。