Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3669932
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T02:18:11+00:00 2026-05-19T02:18:11+00:00

I have a problem with a locally installed library. In my project there is

  • 0

I have a problem with a locally installed library. In my project there is the xmlrpc++0.7-library:

myproject/
 +-- xmlrpc++0.7/
      +-- src/

I want CMake to fallback using the local xmlrpc++0.7 directory if not found otherwise. Two problems, the first one, find_path() or find_library() does not work with local dir. I used a workaround testing if variables processed by find_xxx() are empty or not. If empty I set them manually. The cmake generates the Makefile without errors now. But if I want to compile the project via make, the c++ compiler returns “error: XmlRpc.h: file not found”. The file XmlRpc.h lies in myproject/xmlrpc++0.7/src and if I compile all them manually it works fine.

Here is my CMakeLists.txt. I am very happy if anyone could me point to the right solution to use cmake under conditions described above.

— CMakeLists.txt —

project(webservice_tesseract)
cmake_minimum_required(VERSION 2.6)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

# find tesseract
find_path(TESSERACT_INCLUDE_DIR tesseract/tesseractmain.h
        /opt/local/include
 /usr/local/include
 /usr/include
 )
find_library(TESSERACT_LIBRARY_DIR 
 NAMES tesseract_main
 PATHS 
 /opt/local/lib/
 /usr/local/lib/
 /usr/lib
 )
message(STATUS "looked for tesseract library.")
message(STATUS "Include file detected: [${TESSERACT_INCLUDE_DIR}].")
message(STATUS "Lib file detected: [${TESSERACT_LIBRARY_DIR}].")
add_library(tesseract STATIC IMPORTED)
set_property(TARGET tesseract PROPERTY IMPORTED_LOCATION 
 ${TESSERACT_LIBRARY_DIR}/libtesseractmain.a
 )

#find xmlrpc++
message(STATUS "cmake home dir: [${CMAKE_HOME_DIRECTORY}].")
set(LOCAL_XMLRPCPLUSPLUS ${CMAKE_HOME_DIRECTORY}/xmlrpc0.7++/)
message(STATUS "xmlrpc++ local dir: [${LOCAL_XMLRPCPLUSPLUS}].")
find_path(XMLRPCPLUSPLUS_INCLUDE_DIR XmlRpcServer.h
 ${LOCAL_XMLRPCPLUSPLUS}src
 /opt/local/include
 /usr/local/include
 /usr/include
 )
find_library(XMLRPCPLUSPLUS_LIBRARY_DIR 
 NAMES XmlRpc
 PATHS 
 ${LOCAL_XMLRPCPLUSPLUS}
 /opt/local/lib/
 /usr/local/lib/
 /usr/lib/
 )
# next lines are an ugly workaround because cmake find_xxx() does not find local stuff
if (XMLRPCPLUSPLUS_INCLUDE_DIR)
else (XMLRPCPLUSPLUS_INCLUDE_DIR)
 set(XMLRPCPLUSPLUS_INCLUDE_DIR ${LOCAL_XMLRPCPLUSPLUS}src)
endif (XMLRPCPLUSPLUS_INCLUDE_DIR)
if (XMLRPCPLUSPLUS_LIBRARY_DIR)
else (XMLRPCPLUSPLUS_LIBRARY_DIR)
 set(XMLRPCPLUSPLUS_LIBRARY_DIR ${LOCAL_XMLRPCPLUSPLUS})
endif (XMLRPCPLUSPLUS_LIBRARY_DIR)
message(STATUS "looked for xmlrpc++ library.")
message(STATUS "Include file detected: [${XMLRPCPLUSPLUS_INCLUDE_DIR}].")
message(STATUS "Lib file detected: [${XMLRPCPLUSPLUS_LIBRARY_DIR}].")
add_library(xmlrpc STATIC IMPORTED)
set_property(TARGET xmlrpc PROPERTY IMPORTED_LOCATION 
 ${XMLRPCPLUSPLUS_LIBRARY_DIR}/libXmlRpc.a
 )
#### link together
include_directories(${XMLRPCPLUSPLUS_INCLUDE_DIR} ${TESSERACT_INCLUDE_DIR})
link_directories(${XMLRPCPLUSPLUS_LIBRARY_DIR} ${TESSERACT_LIBRARY_DIR})
add_library(simpleocr STATIC simple_ocr.cpp)
add_executable(webservice_tesseract webservice.cpp)
target_link_libraries(webservice_tesseract xmlrpc tesseract simpleocr)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T02:18:12+00:00Added an answer on May 19, 2026 at 2:18 am

    find_library does not care about local/global paths as you call them. It searches the paths where you specify it to look for. Verify that the paths you are searching for are correct. In your question you mention xmlrpc++0.7 but in your cmakelists.txt you look for xmlrpc0.7++ which would explain why it is not found. Also, as you say, the compiler fails on not finding xmlrpc.h but you use xmlrpcserver.h to find the path.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have problem with return statment >.< I want to store all magazine names
I have a problem using the Java search function in Eclipse on a particular
I have a problem in my project with the .designer which as everyone know
I have the following problem. When I developed my application locally I was deploying
I have problem in some JavaScript that I am writing where the Switch statement
I have problem with starting processes in impersonated context in ASP.NET 2.0. I am
I have problem compilin this code..can anyone tell whats wrong with the syntax CREATE
I have problem with ActionLink. I'd like to pass to my ActionLink parameter for
I have problem when I try insert some data to Informix TEXT column via
I do not have problem as such but I am quite new to Ruby.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.