Re: [CMake] CHECK_INCLUDE_FILE_CXX with built from source compiler

2017-03-13 Thread houssen

Forgot to mention:

~> cmake --version
cmake version 3.5.0


Le 2017-03-13 19:33, houssen a écrit :

Hello,

I do NOT use /usr/bin/g++ that is installed in the system (long story
- don't ask why).
I compiled gcc from source and installed it in 
/my/path/local/bin/g++.


Now I need to check for tuple with CHECK_INCLUDE_FILE_CXX : it fails 
!


Still failing if:
1. I export CPLUS_INCLUDE_PATH to point at
/my/path/local/include/c++/x.y.z (I checked: tuple is here)
2. set this before calling CHECK_INCLUDE_FILE_CXX :
  SET ( CMAKE_REQUIRED_FLAGS "-I$ENV{CPLUS_INCLUDE_PATH}" )
  SET ( CMAKE_REQUIRED_INCLUDES "$ENV{CPLUS_INCLUDE_PATH}" )

What is wrong ?

Franck


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

[CMake] CHECK_INCLUDE_FILE_CXX with built from source compiler

2017-03-13 Thread houssen

Hello,

I do NOT use /usr/bin/g++ that is installed in the system (long story - 
don't ask why).

I compiled gcc from source and installed it in /my/path/local/bin/g++.

Now I need to check for tuple with CHECK_INCLUDE_FILE_CXX : it fails !

Still failing if:
1. I export CPLUS_INCLUDE_PATH to point at 
/my/path/local/include/c++/x.y.z (I checked: tuple is here)

2. set this before calling CHECK_INCLUDE_FILE_CXX :
  SET ( CMAKE_REQUIRED_FLAGS "-I$ENV{CPLUS_INCLUDE_PATH}" )
  SET ( CMAKE_REQUIRED_INCLUDES "$ENV{CPLUS_INCLUDE_PATH}" )

What is wrong ?

Franck
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake


[CMake] Clarifying PUBLIC_HEADER property and non-FRAMEWORK / STATIC / INTERFACE libraries

2017-03-13 Thread Andrew Fuller
I'm finding the PUBLIC_HEADER target property to be quite convenient for 
clarity's sake.  Specifically it spells out quite unambiguously that "hey, 
these are the headers I want to be published" while at the same time providing 
locality to the export details with "PUBLIC_HEADER DESTINATION foo" and 
"INCLUDES DESTINATION foo".  Less code by not needing a separate "install( 
FILES … )" stanza is a bonus.


The documentation for the PUBLIC_HEADER property seems to stress (framework) 
shared libraries.  I'm left wondering if I'm abusing PUBLIC_HEADER by using it 
on static libraries as well.  Am I going to get bit down the road by doing 
this, or is this use perfectly acceptable?


Assuming it's fine to use on static libraries, then how about interface 
libraries?  I see there have been previous discussions on the mailing list 
about whether more properties should be whitelisted for interface targets, but 
I didn't see PUBLIC_HEADER brought up.  Updating the interface includes 
directory using the "INCLUDES DESTINATION foo" when exporting an interface 
library already works, so it would be very nice to be able to leverage 
PUBLIC_HEADER at the same time.  Again, for clarity/consistency/less code.  Is 
there a technical limitation, or is it just a matter of adding public_header to 
the whitelist?  For now I've just got an extra "install( FILES … )" stanza.


Thanks in advance.
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

[CMake] Download more then one repo prior to build_command

2017-03-13 Thread Rian Quinn
Below is my current cmake script for building libc++. There are several things 
about this script I would like to cleanup, but the really big one is fact that 
I have to download libcxx and libcxxabi twice. This is because libcxx, 
libcxxabi and llvm have a circular dependency (each relies on the other), so 
all three repos need to be downloaded before libcxxabi can be built, and then 
finally libcxx. 

Any thoughts on ways I can remove the extra download? I tried setting 
DOWNLOAD_COMMAND “”, and then setting SOURCE_DIR to the previously downloaded 
location, but cmake complains about the fact that the directory is empty 
(because it has not been downloaded during the configure step). 

Thanks,
- Rian




# cmake -DCMAKE_TOOLCHAIN_FILE=~/bfprefix/cmake/CMakeToolchain_VMM.txt 
-DDISABLE_WARNINGS=on ..

cmake_minimum_required(VERSION 3.4)
project(bfsysroot C CXX)

if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/bfprefix" CACHE PATH "default install 
path" FORCE)
endif()

include("${CMAKE_INSTALL_PREFIX}/cmake/CMakeGlobal_Project.txt")

# --
# Newlib
# --

list(APPEND NEWLIB_ARGS
"--prefix=${CMAKE_INSTALL_PREFIX}/sysroots/"
"--target=${BAREFLANK_TARGET}"
"--disable-libgloss"
"--disable-multilib"
"--disable-newlib-supplied-syscalls"
"--enable-newlib-multithread"
"--enable-newlib-iconv"
"CC_FOR_TARGET=${CMAKE_C_COMPILER}"
"CXX_FOR_TARGET=${CMAKE_CXX_COMPILER}"
)

ExternalProject_Add(
newlib
PREFIX ${CMAKE_BINARY_DIR}/newlib
GIT_REPOSITORY https://github.com/Bareflank/newlib.git
GIT_TAG newlib-2.5.0-v1.2
CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/newlib/configure 
"${NEWLIB_ARGS}" CFLAGS_FOR_TARGET=${CMAKE_C_FLAGS}
BUILD_COMMAND make
INSTALL_COMMAND make install
LOG_CONFIGURE 1
LOG_BUILD 1
LOG_INSTALL 1
)

# --
# Unwind
# --

list(APPEND BFUNWIND_CMAKE_ARGS
"-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}"
"-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}"
)

ExternalProject_Add(
bfunwind
PREFIX ${CMAKE_BINARY_DIR}/bfunwind
GIT_REPOSITORY https://github.com/Bareflank/bfunwind.git
CMAKE_ARGS ${BFUNWIND_CMAKE_ARGS}
DEPENDS newlib
)

# --
# Download LLVM
# --

ExternalProject_Add(
download_llvm
PREFIX ${CMAKE_BINARY_DIR}/download_llvm
DOWNLOAD_COMMAND git clone --depth 1 -b release_39 
https://github.com/llvm-mirror/llvm.git download_llvm
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)

# --
# Download Libcxxabi
# --

ExternalProject_Add(
download_libcxxabi
PREFIX ${CMAKE_BINARY_DIR}/download_libcxxabi
DOWNLOAD_COMMAND git clone --depth 1 -b libcxxabi-39-v1 
https://github.com/Bareflank/libcxxabi.git download_libcxxabi
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)

# --
# Download Libcxx
# --

ExternalProject_Add(
download_libcxx
PREFIX ${CMAKE_BINARY_DIR}/download_libcxx
DOWNLOAD_COMMAND git clone --depth 1 -b libcxx-39-v1 
https://github.com/Bareflank/libcxx.git download_libcxx
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)

# --
# Libcxxabi
# --

list(APPEND LIBCXXABI_CMAKE_ARGS
"-DCMAKE_INSTALL_PREFIX=${BAREFLANK_SYSROOT_PATH}"
"-DLLVM_PATH=${CMAKE_BINARY_DIR}/download_llvm/src/download_llvm"

"-DLIBCXXABI_LIBCXX_PATH=${CMAKE_BINARY_DIR}/download_libcxx/src/download_libcxx"
"-DLIBCXXABI_SYSROOT=${BAREFLANK_SYSROOT_PATH}"
"-DLIBCXXABI_HAS_PTHREAD_API=ON"
"-DLLVM_ENABLE_LIBCXX=ON"
"-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}"
"-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}"
"-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}"
"-DCMAKE_AR=${CMAKE_AR}"
"-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}"
"-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}"
)

ExternalProject_Add(
libcxxabi
PREFIX ${CMAKE_BINARY_DIR}/libcxxabi
DOWNLOAD_COMMAND git clone --depth 1 -b libcxxabi-39-v1 
https://github.com/Baref

Re: [CMake] Link to local glibc

2017-03-13 Thread Michele Portolan

At the end of the day, here is what I did:

 1) create a development Centos 5.5 machine

 2) on the dev machine, I compiled gcc 4.9.3 from sources, installed it 
locally and updated the build system (cmake, etc..) with only local 
builds, if possible from source. By exploiting LD_LIBRARY_PATH, I link 
to the glibc et al. in the gcc 4.9.3 installation path


 3) I run Cmake on the dev machine, to obtain the executables and libraries

 4) I prepare a distribution with the Cmake-built exe and libs, and in 
case of dynamic linking, the dependecies found by ldd


 5) I unpack the distribution on my target Cento0S 5.5 machine and run 
the execs, if needed using LD_LIBRARY_PATH for the local libs



Quite the workaround, but it works better than manually handling all 
glibc dependencies!



Michele


On 08/03/17 17:57, Chuck Atkins wrote:


I'll try and see if I can compile a gcc 4.9.3 chain on the CentOS
5 machine (I need C++11).

I'd suggest using the devtollset repo from 
https://people.centos.org/tru/devtools/devtools.repo


The docker container looks interesting but I haven't used it yet:
does it need some specific install on the target machine? I don't
have any install rights on the Cento 5.11 machine


I think you misunderstand.  I meant to use a docker container on your 
Ubuntu machine running CentOS 5 as a development environment.  That 
way you can use your Ubuntu workstation to build in a CentOS 5 
environment.


- Chuck



-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake