Re: [CMake] problem creating a library on mac

2007-10-01 Thread Marie-Christine Vallet

Hi,
Apparently it's is the way the library is built, in my case, it should 
be build with the -c option, but I don't know how to specify that in the 
cmakefile.txt, could someone help me out,

Thanks
Marie
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] problem creating a library on mac

2007-09-27 Thread John Doe
Did you run nm on the library containing these symbols to verify they exist?

_tetra_zone_copy_
_xyz_vertex_copy_

The trailing underscore is reminiscent of a Fortran compiler.  Are you using
the write convention when calling these functions from C code?  On Linux,
you would call the Fortran function foo as foo_.

Should you be linking against libm, if you are getting the same symbols from
libimf.a?

ld: warning multiple definitions of symbol _modf
/opt/intel/cc/10.0.016/lib/libimf.a(modf_stub.o) definition of _modf in
section (__TEXT,__text)
/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../..//libm.dylib(xmm_floor.o)
definition of _modf

Regards,

Juan

On 9/27/07, Marie-Christine Vallet <[EMAIL PROTECTED]> wrote:
>
> Mike Jackson wrote:
> > Marie,
> >   Use the following in your CMakeLists.txt file, generally near the
> > top just after you define the PROJECT (... )
> >
> > SET (LIBRARY_OUTPUT_PATH "${PROJECT_BINARY_DIR}/Bin" CACHE INTERNAL
> > "For libraries.")
> > SET (EXECUTABLE_OUTPUT_PATH "${PROJECT_BINARY_DIR}/Bin" CACHE INTERNAL
> > "For executables.")
> >
> done
> > This will put all the compiled libraries and executables into the same
> > bin directory.
> >
> > Also, I think you may be missing a key philosophy of CMake which is
> > "Out of Source" builds. In your project folder create a new folder
> > called "Build". Then from the a terminal run the following commands:
> >  cd Build
> >  cmake ../
> >  make
> >
> thanks, I did not know that
> >
> > Also, on to the actual problem, can you post the actual linker
> > command? Run "make VERBOSE=1" and post the output.
> >
> I did the modifications you suggested, but  it still does not work. For
> the include directory, I had to keep
> these lines :
>
> *--
>
> > SET(SKINMESH_INCLUDE_DIR
> > ${CMAKE_SOURCE_DIR}/skinmesh
> > )
>
>
> > SET(INCLUDE_DIR
> > ${INCLUDE_DIR}
> > ${SKINMESH_INCLUDE_DIR}
> >
> > )
>
> > SET(INCLUDE_DIR
> > ${INCLUDE_DIR}
> > ${SKINMESH_INCLUDE_DIR}
> >
> > )
> *--
> even though I did made the modification suggested in cmake file  the
> source directory otherwise, it was not working
>
> Here is my  linker command:
>
> Linking CXX executable ../bin/mdi
> cd /Users/program/qtskinmesh/build/mdi && /usr/local/bin/cmake -P
> CMakeFiles/mdi.dir/cmake_clean_target.cmake
> cd /Users/program/qtskinmesh/build/mdi &&
> /opt/intel/cc/10.0.016/bin/icpc -O3 -mp1 -Kc++ -Dintel
> -headerpad_max_install_names  -bind_at_load "CMakeFiles/mdi.dir/main.o"
> "CMakeFiles/mdi.dir/csbdmainwindow.o" "CMakeFiles/mdi.dir/csbdmdichild.o"
> "CMakeFiles/mdi.dir/moc_csbdmainwindow.o"
> "CMakeFiles/mdi.dir/moc_csbdmdichild.o"
> "CMakeFiles/mdi.dir/qrc_qt4skinmesh.o"   -o ../bin/mdi
> -L/Users/program/qtskinmesh/build/skinmesh
> -L/Users/program/qtskinmesh/build/bin -L/usr/local/lib
> -L/usr/X11R6/lib -L/opt/intel/fc/10.0.016/lib -F/Library/Frameworks
> -framework QtGui -framework Carbon -framework QuickTime -framework QtXml
> -framework QtCore -lz -framework ApplicationServices -framework QtOpenGL
> -lQGLViewer -lgmp -lm -lGL -lGLU -lirc -limf -lifcore -lskinmesh -lgmp -lm
> -lGL -lGLU -lirc -limf -lifcore
> ld: warning multiple definitions of symbol _modf
> /opt/intel/cc/10.0.016/lib/libimf.a(modf_stub.o) definition of _modf in
> section (__TEXT,__text)
> /usr/lib/gcc/i686-apple-darwin8/4.0.1/../../..//libm.dylib(xmm_floor.o)
> definition of _modf
> ld: Undefined symbols:
> _tetra_zone_copy_
> _xyz_vertex_copy_
>
>
> and my Undefined symbols are all part of my newly created library
> skinmesh.  What suprrisses me the most is that all that works on fedora
> core 6
>
> Thanks again,
> Marie
>
>
>
>
> ___
> CMake mailing list
> CMake@cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] problem creating a library on mac

2007-09-27 Thread Marie-Christine Vallet

Mike Jackson wrote:
Are there actual implementations for the undefined functions? If there 
are implementations, are they being skipped because of some #define? 
Just some simple mistakes that I have made in the past.


The thing is the code is the same for linux and for mac, and it works 
well with linux. If I manually generate the linking part without using 
the library, explicitly using the .o file, the linking works and 
generates a working executable.

also, is there an actual libskinmesh.a in the following location:
/Users/program/qtskinmesh/build/skinmesh
or
/Users/program/qtskinmesh/build/bin


it's in /Users/program/qtskinmesh/build/bin


--Mike Jackson   Senior Research Engineer
Innovative Management & Technology Services


as suggested previously, I also tried to change the linker  order (by 
hand) by putting the newly generated library at the end (since non of 
the other libraries are independent on my newly created one) but that 
does not work either.

___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] problem creating a library on mac

2007-09-27 Thread Mike Jackson
Are there actual implementations for the undefined functions? If  
there are implementations, are they being skipped because of some  
#define? Just some simple mistakes that I have made in the past.


also, is there an actual libskinmesh.a in the following location:
/Users/program/qtskinmesh/build/skinmesh
or
/Users/program/qtskinmesh/build/bin


--
Mike Jackson   Senior Research Engineer
Innovative Management & Technology Services


On Sep 27, 2007, at 6:52 PM, Marie-Christine Vallet wrote:


Linking CXX executable ../bin/mdi
cd /Users/program/qtskinmesh/build/mdi && /usr/local/bin/cmake -P
CMakeFiles/mdi.dir/cmake_clean_target.cmake
cd /Users/program/qtskinmesh/build/mdi &&
/opt/intel/cc/10.0.016/bin/icpc -O3 -mp1 -Kc++ -Dintel
-headerpad_max_install_names  -bind_at_load "CMakeFiles/mdi.dir/ 
main.o"
"CMakeFiles/mdi.dir/csbdmainwindow.o" "CMakeFiles/mdi.dir/ 
csbdmdichild.o"

"CMakeFiles/mdi.dir/moc_csbdmainwindow.o"
"CMakeFiles/mdi.dir/moc_csbdmdichild.o"
"CMakeFiles/mdi.dir/qrc_qt4skinmesh.o"   -o ../bin/mdi -L/Users/ 
program/qtskinmesh/build/skinmesh

-L/Users/program/qtskinmesh/build/bin -L/usr/local/lib
-L/usr/X11R6/lib -L/opt/intel/fc/10.0.016/lib -F/Library/Frameworks
-framework QtGui -framework Carbon -framework QuickTime -framework  
QtXml
-framework QtCore -lz -framework ApplicationServices -framework  
QtOpenGL
-lQGLViewer -lgmp -lm -lGL -lGLU -lirc -limf -lifcore -lskinmesh - 
lgmp -lm
-lGL -lGLU -lirc -limf -lifcore ld: warning multiple definitions of  
symbol _modf
/opt/intel/cc/10.0.016/lib/libimf.a(modf_stub.o) definition of  
_modf in

section (__TEXT,__text)
/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../..//libm.dylib 
(xmm_floor.o)

definition of _modf
ld: Undefined symbols:
_tetra_zone_copy_
_xyz_vertex_copy_


and my Undefined symbols are all part of my newly created library  
skinmesh.  What suprrisses me the most is that all that works on  
fedora core 6


___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] problem creating a library on mac

2007-09-27 Thread Marie-Christine Vallet

Mike Jackson wrote:

Marie,
  Use the following in your CMakeLists.txt file, generally near the 
top just after you define the PROJECT (... )


SET (LIBRARY_OUTPUT_PATH "${PROJECT_BINARY_DIR}/Bin" CACHE INTERNAL 
"For libraries.")
SET (EXECUTABLE_OUTPUT_PATH "${PROJECT_BINARY_DIR}/Bin" CACHE INTERNAL 
"For executables.")



done
This will put all the compiled libraries and executables into the same 
bin directory.


Also, I think you may be missing a key philosophy of CMake which is 
"Out of Source" builds. In your project folder create a new folder 
called "Build". Then from the a terminal run the following commands:

 cd Build
 cmake ../
 make


thanks, I did not know that


Also, on to the actual problem, can you post the actual linker 
command? Run "make VERBOSE=1" and post the output.


I did the modifications you suggested, but  it still does not work. For 
the include directory, I had to keep

these lines :

*--


SET(SKINMESH_INCLUDE_DIR
${CMAKE_SOURCE_DIR}/skinmesh
)




SET(INCLUDE_DIR
${INCLUDE_DIR}
${SKINMESH_INCLUDE_DIR}

)



SET(INCLUDE_DIR
${INCLUDE_DIR}
${SKINMESH_INCLUDE_DIR}

)

*--
even though I did made the modification suggested in cmake file  the 
source directory otherwise, it was not working


Here is my  linker command:

Linking CXX executable ../bin/mdi
cd /Users/program/qtskinmesh/build/mdi && /usr/local/bin/cmake -P
CMakeFiles/mdi.dir/cmake_clean_target.cmake
cd /Users/program/qtskinmesh/build/mdi &&
/opt/intel/cc/10.0.016/bin/icpc -O3 -mp1 -Kc++ -Dintel
-headerpad_max_install_names  -bind_at_load "CMakeFiles/mdi.dir/main.o"
"CMakeFiles/mdi.dir/csbdmainwindow.o" "CMakeFiles/mdi.dir/csbdmdichild.o"
"CMakeFiles/mdi.dir/moc_csbdmainwindow.o"
"CMakeFiles/mdi.dir/moc_csbdmdichild.o"
"CMakeFiles/mdi.dir/qrc_qt4skinmesh.o"   -o ../bin/mdi 
-L/Users/program/qtskinmesh/build/skinmesh

-L/Users/program/qtskinmesh/build/bin -L/usr/local/lib
-L/usr/X11R6/lib -L/opt/intel/fc/10.0.016/lib -F/Library/Frameworks
-framework QtGui -framework Carbon -framework QuickTime -framework QtXml
-framework QtCore -lz -framework ApplicationServices -framework QtOpenGL
-lQGLViewer -lgmp -lm -lGL -lGLU -lirc -limf -lifcore -lskinmesh -lgmp -lm
-lGL -lGLU -lirc -limf -lifcore 
ld: warning multiple definitions of symbol _modf

/opt/intel/cc/10.0.016/lib/libimf.a(modf_stub.o) definition of _modf in
section (__TEXT,__text)
/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../..//libm.dylib(xmm_floor.o)
definition of _modf
ld: Undefined symbols:
_tetra_zone_copy_
_xyz_vertex_copy_


and my Undefined symbols are all part of my newly created library 
skinmesh.  What suprrisses me the most is that all that works on fedora 
core 6


Thanks again,
Marie




___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] problem creating a library on mac

2007-09-27 Thread Marie-Christine Vallet

Mike Jackson wrote:
Comments are in-line. (Note, this is one particular style of using 
CMake, other variations are perfectly valid)


--Mike Jackson   Senior Research Engineer
Innovative Management & Technology Services


On Sep 27, 2007, at 2:50 PM, Marie-Christine Vallet wrote:



Hi,
I have a project which in which I create a library and then I 
use
this library with my executable. The way I set it up seem to be 
working on

linux (fedora) but it does not work on mac ox10.
Could someone tell me what I am doing wrong,
Thanks,
Marie

Project tree

*Projectdir
 **mdi
 **skinmesh

in my project directory I have the following cmake file :

--
project(mdi C Fortran CXX)


cmake_minimum_required(VERSION 2.4.0)


# Set a variable to point to our top level project directory
SET (MDI_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})




SET(PROJECT_BINARY_DIR
${CMAKE_SOURCE_DIR}/bin)

SET(LIBRARY_OUTPUT_PATH
${CMAKE_SOURCE_DIR}/lib)


# Add some include paths to the subdirectories
INCLUDE_DIRECTORIES ( ${MDI_SOURCE_DIR}/mdi
${MDI_SOURCE_DIR}/skinmesh  )



# tell cmake to process CMakeLists.txt in these subdirectory
#they have to be added separately for it to work
#this subdirectory will create a lib so I put the lib in the lib folder
add_subdirectory(
skinmesh
${PROJECT_BINARY_DIR}
)


add_subdirectory( skinmesh  ${PROJECT_BINARY_DIR}/skinmesh )
add_subdirectory( mdi  ${PROJECT_BINARY_DIR}/mdi )




#this add the executable in the bin directory
add_subdirectory (
mdi
${PROJECT_BINARY_DIR}
)

--

In the mdi directory I have the following cmake file (part of it 
anyay) :



--

[..]


SET(SKINMESH_LIBRARIES
${LIBRARY_OUTPUT_PATH}/libskinmesh.a
)


This is NOT needed because CMake will "know" about the library 
libSkinMesh.a



SET(SKINMESH_INCLUDE_DIR
${CMAKE_SOURCE_DIR}/skinmesh
)


This was taken care of in the top level CMakeLists.txt file and is NOT 
needed



SET(INCLUDE_DIR
${INCLUDE_DIR}
${SKINMESH_INCLUDE_DIR}

)


 NOT NEEDED...


SET(LIBRARIES
 ${LIBRARIES}
${SKINMESH_LIBRARIES})


NOT needed. Use the name of the library directly in the 
TARGET_LINK_LIBRARIES function:

 SET (SKINMESH_LIB_NAME "skinmesh" )





[..]

# Mac configuration
 IF ( CMAKE_SYSTEM_NAME MATCHES "Darwin" )


#setting flags

SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -mp1 -Kc++ -Dintel")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -mp1 -Kc++ -Dintel")

   #equivalent to ldflag
SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} 
-bind_at_load")


ENDIF ( CMAKE_SYSTEM_NAME MATCHES "Darwin" )


#VARIABLE INITIALISATION

# set source files

[..]

SET(mdi_EXECUTABLE
 ${mdi_SRCS}
 ${mdi_UIS_H}
 ${mdi_MOC_SRCS}
 ${mdi_RCC_SRCS}
)



This

INCLUDE_DIRECTORIES(${INCLUDE_DIR})
 link_directories (${PROJECT_BINARY_DIR}/skinmesh)


CMAKE will KNOW where to look for the library. Not needed.




# create an executable file named "mdi" from the source files in the
variable "mdi_SRCS".

ADD_EXECUTABLE ( mdi ${mdi_EXECUTABLE} )


TARGET_LINK_LIBRARIES ( mdi
${LIBRARIES}
  )



TARGET_LINK_LIBRARIES (mdi ${SKINMESH_LIB_NAME})



-
In the skinmesh directory I have the following cmake file (part of it 
anyay) :


-
# create an executable file named "skinmesh" from the source files in 
the

variable "skinmesh_SRCS".
ADD_LIBRARY ( skinmesh STATIC
 ${skinmesh_SRCS}
   )

#set the linker language
SET_TARGET_PROPERTIES(skinmesh
PROPERTIES
LINKER_LANGUAGE CXX
)

[..]


# Mac configuration
 IF ( CMAKE_SYSTEM_NAME MATCHES "Darwin" )

#setting flags
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -c -O3 -mp1 -Kc++ -Dintel")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -c -O3 -mp1 -Kc++ 
-Dintel")
SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -c -u -O3 
-mp1 -w90 -w95

-cpp ")

#equivalent to ldflag
SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -O3 
-Kc++ -mp1

-bind_at_load")

ENDIF ( CMAKE_SYSTEM_NAME MATCHES "Darwin" )



This...

 INCLUDE_DIRECTORIES (${INCLUDE_DIR})


Most likely not needed because we set the include directories in the 
top level CMakeLists.txt file




TARGET_LINK_LIBRARIES (skinmesh
${PROJECT_LIBRARIES}
)


I will assume that PROJECT_LIBRARIES was set somewhere above and has 
all your 3rd party libraries that you need listed.


hope some of this helps.



___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] problem creating a library on mac

2007-09-27 Thread Juan Sanchez
Marie-Christine Vallet wrote:
> Juan Sanchez wrote:
>> Could this be an issue with linker order?  Most linkers are one pass.
>> The library containing the undefined references should be on the linker
>> line before the library containing the symbols, or vice-versa (I keep
>> forgetting).
>>
>>   
> The symbols are part of the newly created library, and they are only 
> reference in the executable
>> Do the libraries contain the symbols that they should?  Use whatever the
>> nm equivalent on mac os is to check.

nm is a unix tool, which google claims to exist on the mac, which tells
you the name of any symbols that are referenced (but undefined), or are
defined somewhere in the objects of an archive file or binary.

If you have a C++ project, you can do:
nm foo.a | c++ filt

to see the human readable version of the symbols in your archive.

If your linker complains about an undefined symbol, you can go looking
for the symbol in the archive you think it belongs to.

For example:

~> nm ctest/hello | grep main
 U __libc_start_main@@GLIBC_2.0
08048424 T main

Says that main is defined in my binary, but the symbol
__libc_start_main@@GLIBC_2.0 is referenced and undefined.

If it is in the appropriate place, you then need to look at the linker
order on the link line.

Regards,

Juan



>>   
> what is nm?
>> Regards,
>>
>> Juan
>>
>>   
> 
> ___
> CMake mailing list
> CMake@cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
> 
> 


-- 
Juan Sanchez
[EMAIL PROTECTED]
800-538-8450 Ext. 54395
512-602-4395


___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] problem creating a library on mac

2007-09-27 Thread Marie-Christine Vallet

Juan Sanchez wrote:

Could this be an issue with linker order?  Most linkers are one pass.
The library containing the undefined references should be on the linker
line before the library containing the symbols, or vice-versa (I keep
forgetting).

  
The symbols are part of the newly created library, and they are only 
reference in the executable

Do the libraries contain the symbols that they should?  Use whatever the
nm equivalent on mac os is to check.
  

what is nm?

Regards,

Juan

  


___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] problem creating a library on mac

2007-09-27 Thread Mike Jackson

Marie,
  Use the following in your CMakeLists.txt file, generally near the  
top just after you define the PROJECT (... )


SET (LIBRARY_OUTPUT_PATH "${PROJECT_BINARY_DIR}/Bin" CACHE INTERNAL  
"For libraries.")
SET (EXECUTABLE_OUTPUT_PATH "${PROJECT_BINARY_DIR}/Bin" CACHE  
INTERNAL "For executables.")


This will put all the compiled libraries and executables into the  
same bin directory.


Also, I think you may be missing a key philosophy of CMake which is  
"Out of Source" builds. In your project folder create a new folder  
called "Build". Then from the a terminal run the following commands:

 cd Build
 cmake ../
 make

What this does is create the Build directory, moves into that  
directory, then runs cmake from within the Build directory. This will  
encapsulate all the cmake files, intermediate files, and compiled  
libraries/executables in ONE sub directory within your project. If  
you ever need to clean to do a CVS update/Checkout/Distribution or  
clean build so can safely remove EVERYTHING within the "Build"  
directory and rerun cmake again. Others in the cmake community will  
put the build directory at the same level as the ProjectDir. So the  
commands look like:

 mkdir Build
 cmake ../ProjectDir
 make

Also, on to the actual problem, can you post the actual linker  
command? Run "make VERBOSE=1" and post the output.


--
Mike Jackson   Senior Research Engineer
Innovative Management & Technology Services


On Sep 27, 2007, at 3:46 PM, Marie-Christine Vallet wrote:


Mike Jackson wrote:

What are the errors you are getting on OS X?

I get an undefined symbol error for several of my variables.
If I do the linking manually, leaving out the library, and putting  
the .o of the library and use the same flags, it works.


Also, at least one comment, I am not sure you want to be setting  
the PROJECT_BINARY_DIR Variable?


What are you trying to do with this statement:

SET(PROJECT_BINARY_DIR
${CMAKE_SOURCE_DIR}/bin)

I just wanted the binary to be in this folder  (and all the files  
created by cmake to be in this directory so I could clean up my  
directory more easily )

___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] problem creating a library on mac

2007-09-27 Thread Juan Sanchez
Could this be an issue with linker order?  Most linkers are one pass.
The library containing the undefined references should be on the linker
line before the library containing the symbols, or vice-versa (I keep
forgetting).

Do the libraries contain the symbols that they should?  Use whatever the
nm equivalent on mac os is to check.

Regards,

Juan

Marie-Christine Vallet wrote:
> Mike Jackson wrote:
>> What are the errors you are getting on OS X?
> I get an undefined symbol error for several of my variables.
> If I do the linking manually, leaving out the library, and putting the 
> .o of the library and use the same flags, it works.
>> Also, at least one comment, I am not sure you want to be setting the 
>> PROJECT_BINARY_DIR Variable?
>>
>> What are you trying to do with this statement:
>>
>> SET(PROJECT_BINARY_DIR
>> ${CMAKE_SOURCE_DIR}/bin)
>>
> I just wanted the binary to be in this folder  (and all the files 
> created by cmake to be in this directory so I could clean up my 
> directory more easily )
> ___
> CMake mailing list
> CMake@cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
> 
> 


-- 
Juan Sanchez
[EMAIL PROTECTED]
800-538-8450 Ext. 54395
512-602-4395


___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] problem creating a library on mac

2007-09-27 Thread Marie-Christine Vallet

Mike Jackson wrote:

What are the errors you are getting on OS X?

I get an undefined symbol error for several of my variables.
If I do the linking manually, leaving out the library, and putting the 
.o of the library and use the same flags, it works.


Also, at least one comment, I am not sure you want to be setting the 
PROJECT_BINARY_DIR Variable?


What are you trying to do with this statement:

SET(PROJECT_BINARY_DIR
${CMAKE_SOURCE_DIR}/bin)

I just wanted the binary to be in this folder  (and all the files 
created by cmake to be in this directory so I could clean up my 
directory more easily )

___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] problem creating a library on mac

2007-09-27 Thread Mike Jackson

What are the errors you are getting on OS X?

Also, at least one comment, I am not sure you want to be setting the  
PROJECT_BINARY_DIR Variable?


What are you trying to do with this statement:

SET(PROJECT_BINARY_DIR
${CMAKE_SOURCE_DIR}/bin)

--
Mike Jackson   Senior Research Engineer
Innovative Management & Technology Services


On Sep 27, 2007, at 2:50 PM, Marie-Christine Vallet wrote:



Hi,
I have a project which in which I create a library and then  
I use
this library with my executable. The way I set it up seem to be  
working on

linux (fedora) but it does not work on mac ox10.
Could someone tell me what I am doing wrong,
Thanks,
Marie

Project tree

*Projectdir
 **mdi
 **skinmesh

in my project directory I have the following cmake file :

--
project(mdi C Fortran CXX)


cmake_minimum_required(VERSION 2.4.0)


SET(PROJECT_BINARY_DIR
${CMAKE_SOURCE_DIR}/bin)

SET(LIBRARY_OUTPUT_PATH
${CMAKE_SOURCE_DIR}/lib)

# tell cmake to process CMakeLists.txt in these subdirectory
#they have to be added separately for it to work
#this subdirectory will create a lib so I put the lib in the lib  
folder

add_subdirectory(
skinmesh
${PROJECT_BINARY_DIR}
)


#this add the executable in the bin directory
add_subdirectory (
mdi
${PROJECT_BINARY_DIR}
)

--

In the mdi directory I have the following cmake file (part of it  
anyay) :



--

[..]


SET(SKINMESH_LIBRARIES
${LIBRARY_OUTPUT_PATH}/libskinmesh.a
)
SET(SKINMESH_INCLUDE_DIR
${CMAKE_SOURCE_DIR}/skinmesh
)
SET(INCLUDE_DIR
${INCLUDE_DIR}
${SKINMESH_INCLUDE_DIR}

)
SET(LIBRARIES
 ${LIBRARIES}
${SKINMESH_LIBRARIES})



[..]

# Mac configuration
 IF ( CMAKE_SYSTEM_NAME MATCHES "Darwin" )


#setting flags
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -mp1 -Kc++ -Dintel")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -mp1 -Kc++ -Dintel")

   #equivalent to ldflag
		SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} - 
bind_at_load")


ENDIF ( CMAKE_SYSTEM_NAME MATCHES "Darwin" )


#VARIABLE INITIALISATION

# set source files

[..]

SET(mdi_EXECUTABLE
 ${mdi_SRCS}
 ${mdi_UIS_H}
 ${mdi_MOC_SRCS}
 ${mdi_RCC_SRCS}
)



INCLUDE_DIRECTORIES(${INCLUDE_DIR})


 link_directories (${PROJECT_BINARY_DIR}/skinmesh)

# create an executable file named "mdi" from the source files in the
variable "mdi_SRCS".

ADD_EXECUTABLE ( mdi
 ${mdi_EXECUTABLE}
   )


TARGET_LINK_LIBRARIES ( mdi
${LIBRARIES}
  )


-




In the skinmesh directory I have the following cmake file (part of  
it anyay) :



-
# create an executable file named "skinmesh" from the source files  
in the

variable "skinmesh_SRCS".
ADD_LIBRARY ( skinmesh STATIC
 ${skinmesh_SRCS}
   )

#set the linker language
SET_TARGET_PROPERTIES(skinmesh
PROPERTIES
LINKER_LANGUAGE CXX
)

[..]


# Mac configuration
 IF ( CMAKE_SYSTEM_NAME MATCHES "Darwin" )

#setting flags
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -c -O3 -mp1 -Kc++ -Dintel")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -c -O3 -mp1 -Kc++ 
-Dintel")
		SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -c -u -O3 -mp1 - 
w90 -w95

-cpp ")

#equivalent to ldflag
		SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -O3 -Kc++ - 
mp1

-bind_at_load")

ENDIF ( CMAKE_SYSTEM_NAME MATCHES "Darwin" )

 INCLUDE_DIRECTORIES (${INCLUDE_DIR})

TARGET_LINK_LIBRARIES (skinmesh
${PROJECT_LIBRARIES}
)


___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake