On Sun, May 10, 2015 at 6:26 AM, Julien Ithurbide wrote:
> Hello,
>
> I compile a soft on linux with this cmake file :
>
> cmake_minimum_required(VERSION 2.8.4)
> project(LCD)
> set(CMAKE_OSX_ARCHITECTURES "x86_64" )
>
> set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
> set( " -stdlib=libstdc++")
You should change this to be like the previous line. ie
---
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++")
---
otherwise you lose previous settings.
or alternatively you can use
---
list(APPEND CMAKE_CXX_FLAGS -std=c++11 -stdlib=libstdc++)
---
either with a separate line for each flag or combined as shown.
> SET(FLTK_DIR /path/to/source/build)
>
> find_package(FLTK REQUIRED NO_MODULE)
> include(${FLTK_USE_FILE})
>
> set(SOURCE_FILES lcd.cpp)
> add_executable(LCD ${SOURCE_FILES})
> TARGET_LINK_LIBRARIES(LCD fltk)
>
> On liunx, it's works like a charm.
>
> But, Now, I want to compile on mac osx. I have compile and install fltk with
> this command :
>
>
> cd /path/to/source/
> mkdir build
> cd build
> cmake ..
> make
> sudo make install
>
> In fact, in linux I dont need to add this line on my cmake file :
> SET(FLTK_DIR /path/to/source/build)
When you install FLTK to a standard location, you don't have to set
FLTK_DIR, find_package looks in all the standard locations
automatically. I'm surprised that this isn't the case with OSX.
> But on mac osx, I need to add it. I can compile my soft but in the linking
> step my compiler tell me this :
>
>
> ld: symbol(s) not found for architecture x86_64
> clang: error: linker command failed with exit code 1 (use -v to see
> invocation)
> make[2]: *** [LCD] Error 1
> make[1]: *** [CMakeFiles/LCD.dir/all] Error 2
> make: *** [all] Error 2
I'm not familiar with the OSX build system, but I know that FLTK with
CMake has been tested on it. Here are a couple of things you could
try.
"make VERBOSE=1" should give more details on the build process.
The SET(FLTK_DIR ...) should point to the location of the
FLTKConfig.cmake FLTK-Targets.cmake and UseFLTK.cmake files. These
are all plaintext files that should have the proper paths for your
includes and libraries, as well as your dependencies and flags.
Verify that these are all ok.
If this doesn't help then we'll have to wait for someone with some OSX
experience.
Let us know what you find.
--
Mike