Re: [CMake] CMake toolchain and FIND_PACKAGE(OpenSSL)

2012-11-19 Thread Vyacheslav Karamov

Hi, try setting

packagename_DIR before FIND_PACKAGE()

19.11.2012 14:41, Boards Killer ?:

Hi CMake Community !

I am writing a CMake toolchain to cross compile our CMake project with 
the Ubuntu ARM Linux toolchain. The CMake toolchain is given below.


I am facing the following problem. When using:
FIND_PACKAGE(OpenSSL)

The libraries (lssl, lcrypto) are *not* found. There are actually 
located at

$ENV{SDK_TARGET}/lib

I thought that adding a LINK_DIRECTORIES to the toolchain would do the 
trick, but no avail.


What is the best way to tell CMake where to find the libraries? Should 
I set the path manually

in the toolchain, for instance.

TIA,
/ld
--
# Cmake toolchain for cross compiling

# target system type
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_VERSION 1)
SET(CMAKE_SYSTEM_PROCESSOR armv7l)

INCLUDE_DIRECTORIES(SYSTEM $ENV{SDK_TARGET}/usr/include)
INCLUDE_DIRECTORIES(SYSTEM 
$ENV{SDK_TARGET}/usr/include/arm-linux-gnueabi)

LINK_DIRECTORIES($ENV{SDK_TARGET}/lib)

# specify the cross compiler
SET(CMAKE_C_COMPILER   arm-linux-gnueabi-gcc)
SET(CMAKE_CXX_COMPILER arm-linux-gnueabi-g++)

# location of target environment
SET(CMAKE_FIND_ROOT_PATH $ENV{SDK_TARGET})

# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)

# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)



--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] Change RPATH at the packaging stage

2012-11-02 Thread Vyacheslav Karamov

Thank you very much, Eric!
It works!

--- CMakeLists.txt --

include (FindSubversion)

if (NOT Subversion_FOUND)
message(FATAL_ERROR Please install subversion command-line client and 
add its folder to the system PATH)

endif()

# Update working copy at every non-debug build
if (NOT (CMAKE_BUILD_TYPE STREQUAL Debug))

add_custom_target(svn_up ALL
# update the working copy
COMMAND ${Subversion_SVN_EXECUTABLE} up ${CMAKE_SOURCE_DIR}
)

endif() # if (NOT (CMAKE_BUILD_TYPE STREQUAL Debug))

# Add code which adds svn revision info at every build

Subversion_WC_INFO(${CMAKE_SOURCE_DIR} ${CMAKE_PROJECT_NAME})

set(chatterbox_revision ${${CMAKE_PROJECT_NAME}_WC_REVISION})

# set product version
set (chatterbox_version_major 1)
set (chatterbox_version_minor 0)
set (chatterbox_version_patch 0)
set (chatterbox_version ${chatterbox_version_major}, 
${chatterbox_version_minor}, ${chatterbox_version_patch}, 
${chatterbox_revision})


set(version_h_contents /**
* Copyright (c) 2008-2012 Transparent Language, Inc. All rights reserved.
*/
#define _VESRION_NUMBER_ ${chatterbox_version}
#define _PRODUCT_NUMBER_ ${chatterbox_version}
#define _VERSION_STRING_ \${chatterbox_version}\
#define _PRODUCT_STRING_ \${chatterbox_version}\
)

#Write version.h
file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/chatterbox/src/version.h 
${version_h_contents})


set (package_version 
${chatterbox_version_major}.${chatterbox_version_minor}.${chatterbox_version_patch})


add_custom_target(configure_cpack ALL
# generate cpackoptions.cmake at build time so we get the
# most recent revision number
COMMAND ${CMAKE_COMMAND}
-DSOURCE_DIR=${CMAKE_SOURCE_DIR}
-Dproj_name=${CMAKE_PROJECT_NAME}
-Drevision=${chatterbox_revision}
-Dpack_version=${package_version}
-P ${CMAKE_SOURCE_DIR}/cmake/Create-cpackoptions.cmake
)

if (NOT (CMAKE_BUILD_TYPE STREQUAL Debug))
add_dependencies(configure_cpack svn_up)
endif()

set(CPACK_PROJECT_CONFIG_FILE ${CMAKE_SOURCE_DIR}/cmake/CPackOptions.cmake)

--- CMakeLists.txt --


---Create-cpackoptions.cmake--

configure_file(${SOURCE_DIR}/cmake/CPackOptions.cmake.in
${SOURCE_DIR}/cmake/CPackOptions.cmake
@ONLY)

---Create-cpackoptions.cmake--


--CPackOptions.cmake.in---

SET(CMAKE_INSTALL_RPATH /opt/@proj_name@)
set(CPACK_PACKAGE_VERSION @pack_version@)
set(CPACK_PACKAGE_FILE_NAME 
@proj_name@-${CPACK_PACKAGE_VERSION}r@revision@-${CPACK_SYSTEM_NAME})


--CPackOptions.cmake.in---

02.11.2012 11:06, Eric Noulard пишет:

2012/11/1 Vyacheslav Karamov ubuntul...@yandex.ru:

Hi All!

Is it possible to change rpath at the packaging stage?

CPack is using cmake_install.cmake scripts which gets influenced
by CMAKE_INSTALL_RPATH variable and/or INSTALL_RPATH target property.

Did you try to play with that? i.e.

SET(CMAKE_INSTALL_RPATH /opt/chatterbox)

you may try to set this in a CPACK_PROJECT_CONFIG_FILE
in order to set it to a CPack-time specific value.

That said I'm not sure it'll work because I don't know for sure when exactly
CMAKE_INSTALL_RPATH is processed, but iit's simple to try.



I have CMake based project with CPack directives in its CMake script:

  if(${CMAKE_SYSTEM_NAME} STREQUAL Linux AND EXISTS 
${CMAKE_ROOT}/Modules/CPack.cmake)

 SET(install_dir /opt/chatterbox)

 SET(CMAKE_SKIP_BUILD_RPATH TRUE)

 SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)

 SET(CMAKE_INSTALL_RPATH /usr/local/lib)

 SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)

...
endif()
--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake





--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] Change RPATH at the packaging stage

2012-11-02 Thread Vyacheslav Karamov

Oh, that is some kind of special street magic!

RPATH is empty without these lines in CMakeLists.txt

set(CPACK_PROJECT_CONFIG_FILE ${CMAKE_SOURCE_DIR}/cmake/CPackOptions.cmake)

if(${CMAKE_SYSTEM_NAME} STREQUAL Linux AND EXISTS 
${CMAKE_ROOT}/Modules/CPack.cmake)


set(CPACK_PACKAGING_INSTALL_PREFIX ${install_dir})
set(CMAKE_INSTALL_RPATH ${install_dir})
endif()



02.11.2012 16:40, Vyacheslav Karamov пишет:

Thank you very much, Eric!
It works!

--- CMakeLists.txt --

include (FindSubversion)

if (NOT Subversion_FOUND)
message(FATAL_ERROR Please install subversion command-line client and 
add its folder to the system PATH)

endif()

# Update working copy at every non-debug build
if (NOT (CMAKE_BUILD_TYPE STREQUAL Debug))

add_custom_target(svn_up ALL
# update the working copy
COMMAND ${Subversion_SVN_EXECUTABLE} up ${CMAKE_SOURCE_DIR}
)

endif() # if (NOT (CMAKE_BUILD_TYPE STREQUAL Debug))

# Add code which adds svn revision info at every build

Subversion_WC_INFO(${CMAKE_SOURCE_DIR} ${CMAKE_PROJECT_NAME})

set(chatterbox_revision ${${CMAKE_PROJECT_NAME}_WC_REVISION})

# set product version
set (chatterbox_version_major 1)
set (chatterbox_version_minor 0)
set (chatterbox_version_patch 0)
set (chatterbox_version ${chatterbox_version_major}, 
${chatterbox_version_minor}, ${chatterbox_version_patch}, 
${chatterbox_revision})


set(version_h_contents /**
* Copyright (c) 2008-2012 Transparent Language, Inc. All rights reserved.
*/
#define _VESRION_NUMBER_ ${chatterbox_version}
#define _PRODUCT_NUMBER_ ${chatterbox_version}
#define _VERSION_STRING_ \${chatterbox_version}\
#define _PRODUCT_STRING_ \${chatterbox_version}\
)

#Write version.h
file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/chatterbox/src/version.h 
${version_h_contents})


set (package_version 
${chatterbox_version_major}.${chatterbox_version_minor}.${chatterbox_version_patch})


add_custom_target(configure_cpack ALL
# generate cpackoptions.cmake at build time so we get the
# most recent revision number
COMMAND ${CMAKE_COMMAND}
-DSOURCE_DIR=${CMAKE_SOURCE_DIR}
-Dproj_name=${CMAKE_PROJECT_NAME}
-Drevision=${chatterbox_revision}
-Dpack_version=${package_version}
-P ${CMAKE_SOURCE_DIR}/cmake/Create-cpackoptions.cmake
)

if (NOT (CMAKE_BUILD_TYPE STREQUAL Debug))
add_dependencies(configure_cpack svn_up)
endif()

set(CPACK_PROJECT_CONFIG_FILE 
${CMAKE_SOURCE_DIR}/cmake/CPackOptions.cmake)


--- CMakeLists.txt --


---Create-cpackoptions.cmake--

configure_file(${SOURCE_DIR}/cmake/CPackOptions.cmake.in
${SOURCE_DIR}/cmake/CPackOptions.cmake
@ONLY)

---Create-cpackoptions.cmake--


--CPackOptions.cmake.in---

SET(CMAKE_INSTALL_RPATH /opt/@proj_name@)
set(CPACK_PACKAGE_VERSION @pack_version@)
set(CPACK_PACKAGE_FILE_NAME 
@proj_name@-${CPACK_PACKAGE_VERSION}r@revision@-${CPACK_SYSTEM_NAME})


--CPackOptions.cmake.in---

02.11.2012 11:06, Eric Noulard пишет:

2012/11/1 Vyacheslav Karamov ubuntul...@yandex.ru:

Hi All!

Is it possible to change rpath at the packaging stage?

CPack is using cmake_install.cmake scripts which gets influenced
by CMAKE_INSTALL_RPATH variable and/or INSTALL_RPATH target property.

Did you try to play with that? i.e.

SET(CMAKE_INSTALL_RPATH /opt/chatterbox)

you may try to set this in a CPACK_PROJECT_CONFIG_FILE
in order to set it to a CPack-time specific value.

That said I'm not sure it'll work because I don't know for sure when 
exactly

CMAKE_INSTALL_RPATH is processed, but iit's simple to try.



I have CMake based project with CPack directives in its CMake script:

  if(${CMAKE_SYSTEM_NAME} STREQUAL Linux AND EXISTS 
${CMAKE_ROOT}/Modules/CPack.cmake)


 SET(install_dir /opt/chatterbox)

 SET(CMAKE_SKIP_BUILD_RPATH TRUE)

 SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)

 SET(CMAKE_INSTALL_RPATH /usr/local/lib)

 SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)

...
endif()
--

Powered by www.kitware.com

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


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


Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake





--

Powered by www.kitware.com

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


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


Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

[CMake] Change RPATH at the packaging stage

2012-11-01 Thread Vyacheslav Karamov
Hi All!

Is it possible to change rpath at the packaging stage?
I have CMake based project with CPack directives in its CMake script:

 if(${CMAKE_SYSTEM_NAME} STREQUAL Linux AND EXISTS 
${CMAKE_ROOT}/Modules/CPack.cmake)

SET(install_dir /opt/chatterbox)

SET(CMAKE_SKIP_BUILD_RPATH TRUE)

SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) 

SET(CMAKE_INSTALL_RPATH /usr/local/lib)

SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)

...
endif()
--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


[CMake] Variable target name visible at the top level

2012-10-26 Thread Vyacheslav Karamov

Hi All!

I have project with the structure similar to this

worker
 | |
 | chatterbox
 | ||
 | |CMakeLists.txt
 | |
 | externals
 | ||
 | |sndlib
 | |   |
 | |   CMakeLists.txt
 | CMakeLists.txt
 |
 CMakeLists.txt



$ cat worker/CMakeLists.txt

cmake_minimum_required(VERSION 2.6)

add_subdirectory(externals)
add_subdirectory(chatterbox)

If I set sndlib target as a variable

set (snd_lib sndlib)
add_library(${snd_lib} SHARED ...)

variable ${snd_lib} is undefined at the parent scope, i.e. I can't use 
${snd_lib} in chatterbox/ CMakeLists.txt


target_link_libraries(chatterbox  ${snd_lib})  # ${snd_lib} is empty!

How to handle this situation in a proper way?








--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Variable target name visible at the top level

2012-10-26 Thread Vyacheslav Karamov

Thank you, but if I need variable two level up?

26.10.2012 12:07, Rolf Eike Beer пишет:

On Fr., 26. Okt. 2012 10:22:51 CEST, Vyacheslav Karamov ubuntul...@yandex.ru 
wrote:


Hi All!

I have project with the structure similar to this
set (snd_lib sndlib)
add_library(${snd_lib} SHARED ...)
How to handle this situation in a proper way?

set(... PARENT_SCOPE)

This will propagate the variable one level up.

Eike


--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] Variable target name visible at the top level

2012-10-26 Thread Vyacheslav Karamov

26.10.2012 12:16, Eric Noulard пишет:

2012/10/26 Vyacheslav Karamov ubuntul...@yandex.ru:

Hi All!

I have project with the structure similar to this

worker
  | |
  | chatterbox
  | ||
  | |CMakeLists.txt
  | |
  | externals
  | ||
  | |sndlib
  | |   |
  | |   CMakeLists.txt
  | CMakeLists.txt
  |
  CMakeLists.txt



$ cat worker/CMakeLists.txt

cmake_minimum_required(VERSION 2.6)

add_subdirectory(externals)
add_subdirectory(chatterbox)

If I set sndlib target as a variable

set (snd_lib sndlib)
add_library(${snd_lib} SHARED ...)

variable ${snd_lib} is undefined at the parent scope, i.e. I can't use
${snd_lib} in chatterbox/ CMakeLists.txt

target_link_libraries(chatterbox  ${snd_lib})  # ${snd_lib} is empty!

From your description this is strange because 'chatterbox'
is a subdir of 'worker' where snd_lib has been defined so it should be
visible, I guess...

unless you define the snd_lib var AFTER you
add_subdirectory(chatterbox)

since add_subdirectory process subdir first you must define
variable you need before add_subdirectory.

I have added externals before chatterbox, so

${snd_lib} should be defined in chatterbox.


How to handle this situation in a proper way?

Define it at the scope it ought to be ?
or use
  set (snd_lib sndlib PARENT_SCOPE)

but again I think your problems comes from the fact
your defined your var after add_subdirectory.

PARENT_SCOPE variable is visible only in a parent scope, not in a 
current one. But I need it in current scope, parent scope and scope 
above parent.


--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] Cmake link trouble in Windows

2012-10-23 Thread Vyacheslav Karamov

Hi!

1. I don't understand what did you mean, but I guess
you want to create library test

ADD_LIBRARY(test SHARED ${FAN_SRC})

then you wanted to specify in which directory some libraries should be 
searched


LINK_DIRECTORIES(${ACE_LIB_DIR})

and then you tried to link library ACE with your target (which is 
probably created by code which was not provided) fan.



23.10.2012 16:59, 张峰 пишет:

hello:
Thanks for your help。 but now i am in another trouble.
In Windows,i am trying to build a shard library,It needs to link 
dynamic library and static library。

when i want to link a dynamic library,it comes:
(fatal error U1073:does not know how to generate ACE.lib)
AUX_SOURCE_DIRECTORY(. SRC)
ADD_LIBRARY(test SHARED ${FAN_SRC})
LINK_DIRECTORIES(${ACE_LIB_DIR})
TARGET_LINK_LIBRARIES(fan ACE)
1. Actually, test should link ACE.dll,how to make test link to 
ACE.dll ?
2.if i use LINK_LIBRARIES() instead of TARGET_LINK_LIBRARIES(),this 
may work,why ??

AUX_SOURCE_DIRECTORY(. SRC)
LINK_DIRECTORIES(${ACE_LIB_DIR})
LINK_LIBRARIES(ACE)
ADD_LIBRARY(test SHARED ${FAN_SRC})
3.Seems Windows will give priority to link static library,but i need 
to link dynamic library in my projects ,how could i do ??
4.how do TARGET_LINK_LIBRARIES() and LINK_LIBRARIES() determine what 
kind of library to link ? DO i need to use LINK_LIBRARIES(ACE.dll) 
instead of LINK_LIBRARIES(ACE) in Windows ?

Waiting for your letter.
With Best Wishes !!





--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

[CMake] target_link_libraries fails if one of the libraries is NOTFOUND

2012-10-14 Thread Vyacheslav Karamov
Hi All!

I've found annoying bug in Cmake 2.8.8 for Linux. I tried to submit it to Cmake 
bug tracker, but I couldn't register.

My target which is dynamic library, uses some static libs:

target_link_libraries(${lib_name} 
debug ${do_scoring_debug}
optimized ${do_scoring}
)

When I tried to build Release configuration of my library, build fails because 
do_scoring_debug == NOTFOUND at that time.
It seems strange to me, because linker doesn't need *Debug* version of 
${do_scoring} when building *Release* version of target.

I've found workaraound

if (NOT do_scoring_debug)
set (do_scoring_debug do_scoring)
endif()

but it seems to strange why should I need it.

___
WBR,
Vyacheslav Karamov.
--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Setting COMPILE_FLAGS property on a target in only debug?

2012-05-05 Thread Vyacheslav Karamov

Hi!

It's pity, but CMAKE_BUILD_TYPE is empty for CMake Visual Studio generator.

04.05.2012 23:40, Tim Gallagher ???:

Put an:

if(CMAKE_BUILD_TYPE STREQUAL Debug)
endif()

guard around the set_property call.

Tim


*From: *Robert Dailey rcdailey.li...@gmail.com
*To: *CMake ML cmake@cmake.org
*Sent: *Friday, May 4, 2012 4:16:47 PM
*Subject: *[CMake] Setting COMPILE_FLAGS property on a target in only 
debug?


I'm doing the following:

set_property( TARGET ${target_name} APPEND_STRING PROPERTY
COMPILE_FLAGS /ZI /Gy 
)

However this applies to all configurations. I want to only set this 
compiler flag for debug builds, not release. How can I do this?


--

Powered by www.kitware.com

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


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


Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake



--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

[CMake] Setting Header Search Path in Xcode project

2012-04-27 Thread Vyacheslav Karamov

Hi All!

I have problem with CMake 2.8.8 in OS X Lion.
CMake include_directories() doen't add Header Search Path to 
CMake-generated Xcode project.



WBR,
Vyacheslav.
--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Setting Header Search Path in Xcode project

2012-04-27 Thread Vyacheslav Karamov

Problem solved by removing Fink version and installing CMake from cmake.org

27.04.2012 18:56, Vyacheslav Karamov написал:

Hi All!

I have problem with CMake 2.8.8 in OS X Lion.
CMake include_directories() doen't add Header Search Path to 
CMake-generated Xcode project.



WBR,
Vyacheslav.
--

Powered by www.kitware.com

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


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


Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake



--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

[CMake] How to add dependency on parent directories?

2012-04-25 Thread Vyacheslav Karamov

Hi All!

My project's (named Compare) structure is similar to this:

Root
   |
 SphinX
   |
   sphinxbase (autotools project)
 Sound
   |
   |-DoScoring (my Cmake-based project)
   |-Compare (my Cmake-based project)
|-CMakeLists.txt
|-src (source files for project Compare)
|-ATLAS (autotools project)

How add dependencies on other projects to CMakeLists.txt of my project 
Compare?



Thank you in advance,
Vyacheslav.

--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


[CMake] target_link_libraries can't link shared libraries not listed in LD_LIBRARY_PATH

2012-04-23 Thread Vyacheslav Karamov

Hi All!

I have a problem with target_link_libraries. It  can't link with shared 
libraries not from directory listed in LD_LIBRARY_PATH.
1. When I try to link shared library with the full path obtained from 
find_library, my library is passed to gcc without -l option as ordinary 
object file.


2. When I try to link by specifying short name cblas I've got the 
error message:


Linking CXX shared library ../../sndcompare/amd64sse3/libsndcompared.so
/usr/bin/ld: cannot find -lcblas
collect2: ld returned 1 exit status
make[2]: *** [../../sndcompare/amd64sse3/libsndcompared.so] Error 1
make[1]: *** [CMakeFiles/sndcompare.dir/all] Error 2
make: *** [all] Error 2
*** Failed ***

OS: Ubuntu 11.10 64 bit
Compiler: g++ 4.6.1.
Cmake 2.8.5


add_library(${lib_name} SHARED
${io_files}
${utils_files}
${tech_independ_files}
${other_files}
)

find_library(atlas
NAME atlas
PATHS 
${CMAKE_CURRENT_SOURCE_DIR}/${CMAKE_SYSTEM_NAME}/atlas/${arch}/lib

DOC Atlas library
)

find_library(cblas
NAME cblas
PATHS 
${CMAKE_CURRENT_SOURCE_DIR}/${CMAKE_SYSTEM_NAME}/atlas/${arch}/lib

DOC Cblas library
)

link_directories(
${CMAKE_CURRENT_SOURCE_DIR}/${CMAKE_SYSTEM_NAME}/atlas/${arch}/lib
${CMAKE_CURRENT_SOURCE_DIR}/../../Sphinx/sphinxbase/${CMAKE_SYSTEM_NAME}/${arch}/lib
)

target_link_libraries(${lib_name}
debug ${do_scoring_debug}
optimized ${do_scoring}
general ${spinx}
general rt
general dl
general pthread
general cblas
general ${atlas}
)


Thank you in advance, Vyacheslav.
--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] target_link_libraries can't link shared libraries not listed in LD_LIBRARY_PATH

2012-04-23 Thread Vyacheslav Karamov

Hi!

I just find the solution. The problem was in order how libraries were 
specified.

target_link_libraries(${lib_name}
general rt
general dl
general pthread
debug ${do_scoring_debug}
optimized ${do_scoring}
general ${spinx}
general ${cblas}
general ${atlas}
)


23.04.2012 16:28, Andreas Pakulat ???:

Hi,

On Mon, Apr 23, 2012 at 13:24, Vyacheslav Karamov 
ubuntul...@yandex.ru mailto:ubuntul...@yandex.ru wrote:


Hi All!

I have a problem with target_link_libraries. It  can't link with
shared libraries not from directory listed in LD_LIBRARY_PATH.
1. When I try to link shared library with the full path obtained
from find_library, my library is passed to gcc without -l option
as ordinary object file.


What is the problem with linking the absolute path of the shared 
library? This should just work


2. When I try to link by specifying short name cblas I've got
the error message:

Linking CXX shared library
../../sndcompare/amd64sse3/libsndcompared.so
/usr/bin/ld: cannot find -lcblas
collect2: ld returned 1 exit status
make[2]: *** [../../sndcompare/amd64sse3/libsndcompared.so] Error 1
make[1]: *** [CMakeFiles/sndcompare.dir/all] Error 2
make: *** [all] Error 2
*** Failed ***


This is because the linker does not know the directory where to search 
for the library.


add_library(${lib_name} SHARED
${io_files}
${utils_files}
${tech_independ_files}
${other_files}
)

find_library(atlas
   NAME atlas
   PATHS
${CMAKE_CURRENT_SOURCE_DIR}/${CMAKE_SYSTEM_NAME}/atlas/${arch}/lib
   DOC Atlas library
   )

find_library(cblas
   NAME cblas
   PATHS
${CMAKE_CURRENT_SOURCE_DIR}/${CMAKE_SYSTEM_NAME}/atlas/${arch}/lib
   DOC Cblas library
   )

link_directories(
${CMAKE_CURRENT_SOURCE_DIR}/${CMAKE_SYSTEM_NAME}/atlas/${arch}/lib

${CMAKE_CURRENT_SOURCE_DIR}/../../Sphinx/sphinxbase/${CMAKE_SYSTEM_NAME}/${arch}/lib
)


link_directories is not needed at all here or should not be needed. 
Just make sure to pass ${cblas} and ${atlas} to
target_link_libraries. If that produces errors please provide the 
exact error message.


Andreas


--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

[CMake] COMPILE_DEFINITIONS_Debug doesn't work in Windows

2012-04-17 Thread Vyacheslav Karamov

Hi All!

I need to add some preprocessor definitions to my target.
Here is the code:

if (WIN32)
set (COMPILE_DEFINITIONS_Debug
_DEBUG
USE_MP3READER2
_EXPORTS
_USRDLL
_CRT_SECURE_NO_WARNINGS
_USE_32BIT_TIME_T
)

set (COMPILE_DEFINITIONS_Release
NDEBUG
USE_MP3READER2
_EXPORTS
_USRDLL
_CRT_SECURE_NO_WARNINGS
_USE_32BIT_TIME_T
)
else(WIN32)

set (COMPILE_DEFINITIONS_Debug
_DEBUG
USE_MP3READER2
)

set (COMPILE_DEFINITIONS_Release
NDEBUG
USE_MP3READER2
)
endif(WIN32)


But when I open Debug configuration of my VS2008 project I see

WIN32;_WINDOWS;_DEBUG;CMAKE_INTDIR=\Debug\

Does someone happen to know how to fix it?


-
WBR,
Vyacheslav.

--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] COMPILE_DEFINITIONS_Debug doesn't work in Windows

2012-04-17 Thread Vyacheslav Karamov

It also doesn't work

set_property(GLOBAL PROPERTY COMPILE_DEFINITIONS_DEBUG 
USE_MP3READER2;DLL_EXPORTS;_USRDLL;_CRT_SECURE_NO_WARNINGS;_USE_32BIT_TIME_T) 

set_property(GLOBAL PROPERTY COMPILE_DEFINITIONS_RELEASE 
USE_MP3READER2;DLL_EXPORTS;_USRDLL;_CRT_SECURE_NO_WARNINGS;_USE_32BIT_TIME_T) 



17.04.2012 11:04, Rolf Eike Beer написал:

Hi All!

I need to add some preprocessor definitions to my target.
Here is the code:

if (WIN32)
  set (COMPILE_DEFINITIONS_Debug
  _DEBUG
  USE_MP3READER2
  _EXPORTS
  _USRDLL
  _CRT_SECURE_NO_WARNINGS
  _USE_32BIT_TIME_T
  )

  set (COMPILE_DEFINITIONS_Release
  NDEBUG
  USE_MP3READER2
  _EXPORTS
  _USRDLL
  _CRT_SECURE_NO_WARNINGS
  _USE_32BIT_TIME_T
  )
else(WIN32)

set (COMPILE_DEFINITIONS_Debug
_DEBUG
USE_MP3READER2
)

set (COMPILE_DEFINITIONS_Release
NDEBUG
USE_MP3READER2
)
endif(WIN32)


But when I open Debug configuration of my VS2008 project I see

WIN32;_WINDOWS;_DEBUG;CMAKE_INTDIR=\Debug\

Does someone happen to know how to fix it?

COMPILE_DEFINITIONS is not a variable, it's a global property. As such you
need to call

set_property(GLOBAL PROPERTY COMPILE_DEFINITIONS_DEBUG ...)

Please note that you also need to uppercase the build type.

Eike
--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake



--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] COMPILE_DEFINITIONS_Debug doesn't work in Windows(SOLVED)

2012-04-17 Thread Vyacheslav Karamov

But this
if (WIN32)
set_property(TARGET ${lib_name} PROPERTY COMPILE_DEFINITIONS_DEBUG 
USE_MP3READER2 DLL_EXPORTS _USRDLL _CRT_SECURE_NO_WARNINGS 
_USE_32BIT_TIME_T)
set_property(TARGET ${lib_name} PROPERTY COMPILE_DEFINITIONS_RELEASE 
USE_MP3READER2;DLL_EXPORTS;_USRDLL;_CRT_SECURE_NO_WARNINGS;_USE_32BIT_TIME_T) 


else(WIN32)
set_property(TARGET ${lib_name} PROPERTY COMPILE_DEFINITIONS_DEBUG 
USE_MP3READER2)
set_property(TARGET ${lib_name} PROPERTY COMPILE_DEFINITIONS_RELEASE 
USE_MP3READER2)

endif(WIN32)

works fine, thanks!


17.04.2012 11:19, Vyacheslav Karamov написал:

It also doesn't work

set_property(GLOBAL PROPERTY COMPILE_DEFINITIONS_DEBUG 
USE_MP3READER2;DLL_EXPORTS;_USRDLL;_CRT_SECURE_NO_WARNINGS;_USE_32BIT_TIME_T) 

set_property(GLOBAL PROPERTY COMPILE_DEFINITIONS_RELEASE 
USE_MP3READER2;DLL_EXPORTS;_USRDLL;_CRT_SECURE_NO_WARNINGS;_USE_32BIT_TIME_T) 



17.04.2012 11:04, Rolf Eike Beer написал:

Hi All!

I need to add some preprocessor definitions to my target.
Here is the code:

if (WIN32)
  set (COMPILE_DEFINITIONS_Debug
  _DEBUG
  USE_MP3READER2
  _EXPORTS
  _USRDLL
  _CRT_SECURE_NO_WARNINGS
  _USE_32BIT_TIME_T
  )

  set (COMPILE_DEFINITIONS_Release
  NDEBUG
  USE_MP3READER2
  _EXPORTS
  _USRDLL
  _CRT_SECURE_NO_WARNINGS
  _USE_32BIT_TIME_T
  )
else(WIN32)

set (COMPILE_DEFINITIONS_Debug
_DEBUG
USE_MP3READER2
)

set (COMPILE_DEFINITIONS_Release
NDEBUG
USE_MP3READER2
)
endif(WIN32)


But when I open Debug configuration of my VS2008 project I see

WIN32;_WINDOWS;_DEBUG;CMAKE_INTDIR=\Debug\

Does someone happen to know how to fix it?
COMPILE_DEFINITIONS is not a variable, it's a global property. As 
such you

need to call

set_property(GLOBAL PROPERTY COMPILE_DEFINITIONS_DEBUG ...)

Please note that you also need to uppercase the build type.

Eike
--

Powered by www.kitware.com

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


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


Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake



--

Powered by www.kitware.com

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


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


Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

[CMake] find_library in Windows

2012-04-17 Thread Vyacheslav Karamov

Hi All!

I have a problem with find_library in Windows. It does find static 
library, but not import library.

It's confusing to me.

if (${CMAKE_SYSTEM_NAME} STREQUAL Windows)

find_library(spinx
NAMES sphinxbase
${CMAKE_CURRENT_SOURCE_DIR}/../../Sphinx/sphinxbase/bin/Release
)

find_library(spinx_debug
NAMES sphinxbased
${CMAKE_CURRENT_SOURCE_DIR}/../../Sphinx/sphinxbase/bin/Debug
)
endif()

if (NOT spinx)
message(STATUS SphinX library has not been found)
endif()

if (NOT spinx_debug)
message(STATUS Debug version of SphinX library has not been found)
endif()


Nor debug neither release versions have been found.
This is strange, because I have
../../Sphinx/sphinxbase/bin/Debug/sphinxbased.dll
../../Sphinx/sphinxbase/bin/Debug/sphinxbase.lib
and
../../Sphinx/sphinxbase/bin/Release/sphinxbase.dll
../../Sphinx/sphinxbase/bin/Release/sphinxbase.lib


I also tried another approach:

link_directories(
${CMAKE_CURRENT_SOURCE_DIR}/../../Sphinx/sphinxbase/bin/Release
${CMAKE_CURRENT_SOURCE_DIR}/../../Sphinx/sphinxbase/bin/Debug
)

target_link_libraries(${lib_name}
debug ${do_scoring_debug} sphinxbased
)

target_link_libraries(${lib_name}
optimized ${do_scoring} sphinxbase
)

but in this case both debug and release versions of sphinxbase are 
linked with my target library.





--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] COMPILE_DEFINITIONS_Debug doesn't work in Windows

2012-04-17 Thread Vyacheslav Karamov

Yes I do.
17.04.2012 11:49, Rolf Eike Beer написал:

It also doesn't work

set_property(GLOBAL PROPERTY COMPILE_DEFINITIONS_DEBUG
USE_MP3READER2;DLL_EXPORTS;_USRDLL;_CRT_SECURE_NO_WARNINGS;_USE_32BIT_TIME_T)

set_property(GLOBAL PROPERTY COMPILE_DEFINITIONS_RELEASE
USE_MP3READER2;DLL_EXPORTS;_USRDLL;_CRT_SECURE_NO_WARNINGS;_USE_32BIT_TIME_T)

Did you use that code before the add_executable() or add_library()?

Eike
--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake



--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] find_library in Windows

2012-04-17 Thread Vyacheslav Karamov

This code doesn't work also:

if (${CMAKE_SYSTEM_NAME} STREQUAL Windows)

find_library(spinx
NAME sphinxbase
HINTS ${CMAKE_CURRENT_SOURCE_DIR}/../../Sphinx/sphinxbase/bin/Release
DOC SphinX release library
)

find_library(spinx_debug
NAME sphinxbased
PATHS ${CMAKE_CURRENT_SOURCE_DIR}/../../Sphinx/sphinxbase/bin/Debug
DOC SphinX debug library
)
endif()

17.04.2012 11:47, Vyacheslav Karamov написал:

Hi All!

I have a problem with find_library in Windows. It does find static 
library, but not import library.

It's confusing to me.

if (${CMAKE_SYSTEM_NAME} STREQUAL Windows)

find_library(spinx
NAMES sphinxbase
${CMAKE_CURRENT_SOURCE_DIR}/../../Sphinx/sphinxbase/bin/Release
)

find_library(spinx_debug
NAMES sphinxbased
${CMAKE_CURRENT_SOURCE_DIR}/../../Sphinx/sphinxbase/bin/Debug
)
endif()

if (NOT spinx)
message(STATUS SphinX library has not been found)
endif()

if (NOT spinx_debug)
message(STATUS Debug version of SphinX library has not been found)
endif()


Nor debug neither release versions have been found.
This is strange, because I have
../../Sphinx/sphinxbase/bin/Debug/sphinxbased.dll
../../Sphinx/sphinxbase/bin/Debug/sphinxbase.lib
and
../../Sphinx/sphinxbase/bin/Release/sphinxbase.dll
../../Sphinx/sphinxbase/bin/Release/sphinxbase.lib


I also tried another approach:

link_directories(
${CMAKE_CURRENT_SOURCE_DIR}/../../Sphinx/sphinxbase/bin/Release
${CMAKE_CURRENT_SOURCE_DIR}/../../Sphinx/sphinxbase/bin/Debug
)

target_link_libraries(${lib_name}
debug ${do_scoring_debug} sphinxbased
)

target_link_libraries(${lib_name}
optimized ${do_scoring} sphinxbase
)

but in this case both debug and release versions of sphinxbase are 
linked with my target library.



--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] find_library in Windows

2012-04-17 Thread Vyacheslav Karamov

When I specified full library name with extension find_library worked.
But still have both debug and release versions of library being linked 
with my target.



17.04.2012 12:13, Vyacheslav Karamov написал:

This code doesn't work also:

if (${CMAKE_SYSTEM_NAME} STREQUAL Windows)

find_library(spinx
NAME sphinxbase
HINTS ${CMAKE_CURRENT_SOURCE_DIR}/../../Sphinx/sphinxbase/bin/Release
DOC SphinX release library
)

find_library(spinx_debug
NAME sphinxbased
PATHS ${CMAKE_CURRENT_SOURCE_DIR}/../../Sphinx/sphinxbase/bin/Debug
DOC SphinX debug library
)
endif()

17.04.2012 11:47, Vyacheslav Karamov написал:

Hi All!

I have a problem with find_library in Windows. It does find static 
library, but not import library.

It's confusing to me.

if (${CMAKE_SYSTEM_NAME} STREQUAL Windows)

find_library(spinx
NAMES sphinxbase
${CMAKE_CURRENT_SOURCE_DIR}/../../Sphinx/sphinxbase/bin/Release
)

find_library(spinx_debug
NAMES sphinxbased
${CMAKE_CURRENT_SOURCE_DIR}/../../Sphinx/sphinxbase/bin/Debug
)
endif()

if (NOT spinx)
message(STATUS SphinX library has not been found)
endif()

if (NOT spinx_debug)
message(STATUS Debug version of SphinX library has not been found)
endif()


Nor debug neither release versions have been found.
This is strange, because I have
../../Sphinx/sphinxbase/bin/Debug/sphinxbased.dll
../../Sphinx/sphinxbase/bin/Debug/sphinxbase.lib
and
../../Sphinx/sphinxbase/bin/Release/sphinxbase.dll
../../Sphinx/sphinxbase/bin/Release/sphinxbase.lib


I also tried another approach:

link_directories(
${CMAKE_CURRENT_SOURCE_DIR}/../../Sphinx/sphinxbase/bin/Release
${CMAKE_CURRENT_SOURCE_DIR}/../../Sphinx/sphinxbase/bin/Debug
)

target_link_libraries(${lib_name}
debug ${do_scoring_debug} sphinxbased
)

target_link_libraries(${lib_name}
optimized ${do_scoring} sphinxbase
)

but in this case both debug and release versions of sphinxbase are 
linked with my target library.



--

Powered by www.kitware.com

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


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


Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] find_library in Windows(SOLVED)

2012-04-17 Thread Vyacheslav Karamov

I'm happy. It works!

target_link_libraries(${lib_name}
debug ${do_scoring_debug}
debug ${spinx_debug}
optimized ${do_scoring}
optimized ${spinx}
)

17.04.2012 14:59, Vyacheslav Karamov написал:

When I specified full library name with extension find_library worked.
But still have both debug and release versions of library being linked 
with my target.



17.04.2012 12:13, Vyacheslav Karamov написал:

This code doesn't work also:

if (${CMAKE_SYSTEM_NAME} STREQUAL Windows)

find_library(spinx
NAME sphinxbase
HINTS ${CMAKE_CURRENT_SOURCE_DIR}/../../Sphinx/sphinxbase/bin/Release
DOC SphinX release library
)

find_library(spinx_debug
NAME sphinxbased
PATHS ${CMAKE_CURRENT_SOURCE_DIR}/../../Sphinx/sphinxbase/bin/Debug
DOC SphinX debug library
)
endif()

17.04.2012 11:47, Vyacheslav Karamov написал:

Hi All!

I have a problem with find_library in Windows. It does find static 
library, but not import library.

It's confusing to me.

if (${CMAKE_SYSTEM_NAME} STREQUAL Windows)

find_library(spinx
NAMES sphinxbase
${CMAKE_CURRENT_SOURCE_DIR}/../../Sphinx/sphinxbase/bin/Release
)

find_library(spinx_debug
NAMES sphinxbased
${CMAKE_CURRENT_SOURCE_DIR}/../../Sphinx/sphinxbase/bin/Debug
)
endif()

if (NOT spinx)
message(STATUS SphinX library has not been found)
endif()

if (NOT spinx_debug)
message(STATUS Debug version of SphinX library has not been found)
endif()


Nor debug neither release versions have been found.
This is strange, because I have
../../Sphinx/sphinxbase/bin/Debug/sphinxbased.dll
../../Sphinx/sphinxbase/bin/Debug/sphinxbase.lib
and
../../Sphinx/sphinxbase/bin/Release/sphinxbase.dll
../../Sphinx/sphinxbase/bin/Release/sphinxbase.lib


I also tried another approach:

link_directories(
${CMAKE_CURRENT_SOURCE_DIR}/../../Sphinx/sphinxbase/bin/Release
${CMAKE_CURRENT_SOURCE_DIR}/../../Sphinx/sphinxbase/bin/Debug
)

target_link_libraries(${lib_name}
debug ${do_scoring_debug} sphinxbased
)

target_link_libraries(${lib_name}
optimized ${do_scoring} sphinxbase
)

but in this case both debug and release versions of sphinxbase are 
linked with my target library.



--

Powered by www.kitware.com

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


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


Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

--

Powered by www.kitware.com

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


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


Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

[CMake] How to find MinGW static library in Windows?

2012-04-17 Thread Vyacheslav Karamov

Hi All!

I have some MinGW static libraries and I need to use them in VS2008 
project which is generated by CMake.


if (${CMAKE_SYSTEM_NAME} STREQUAL Windows)

set(CMAKE_FIND_LIBRARY_PREFIXES ${CMAKE_FIND_LIBRARY_PREFIXES} lib)
set(CMAKE_FIND_LIBRARY_SUFFIXES  .a ${CMAKE_FIND_LIBRARY_SUFFIXES})


find_library(libatlas
NAME atlas
HINTS 
${CMAKE_CURRENT_SOURCE_DIR}/${CMAKE_SYSTEM_NAME}/atlas/x86sse2/lib

DOC Atlas libraries
)


target_link_libraries(${lib_name}
${libatlas}
)

But CMake adds .lib at the end of the library name. This is not what I 
expect.



WBR,
Vyacheslav.
--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake