[CMake] Merging a project from autoconf and GNUMakefiles
I am trying to merge a project that was using autoconf and GNUMakefiles. When you use automake you can build static libraries in sub directories and then link them together into one shared library in the end that was install. This is not possible with Visual Studio. In GNU Make for the project I can see that there are GNMakefiles in the subdirectories that build the object files where they are linked together in the top level GNUMakefile. In projects I have done where I have had source files in subdirectories I could include all of them in a variable in the single CMakeLists.txt file in the top directory. This project has 1079 C++ and C files in a variety of subdirectories. The only way I can see to make a single shared library with CMake is to include all the source files into a single variable in the single CMakeLists.txt file like I do in my own projects. So to do this same technique with this project seems unreasonable to ask these developers to adopt. So I am wondering if I can set a single variable used across a variety of CMakeLists.txt files? So that way in subdirectoryA I can add files to a variable called SOURCES that I append files in from subdirectoryB. Therefore in the top level CMakeLists.txt file I can declare: add_library ( target ${SOURCES} ) target_link_libraries ( target ${DEPENDENCY_LIBRARIES} ) In a similar way I can include those headers I want to install in all the subdirectories. Stephen ___ 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] Creating a XXXConfigYYY.cmake file
I have been reading email posts on goggle that says if you create a library then produce a Configcmake file rather than a Find.cmake file. That is fine but what confuses me is: 1. What do I put in it? 2. How do I install it? (e.g. Linux and Windows) 3. What google search terms should I use to find more information on this topic? I have a large project is broken up into three separate projects each with their own CMakeLists.txt. For the sake of discussion lets call them Larry, Curly and Mo. Now Larry is the base library. Supposing I knew what I was doing I would create a LarryConfig1.0.cmake file and install it. I would do the same for the others. Do I just use find_package in the CMakeLists.txt of Curly and Mo to find the Larry library? Is there a tutorial on how to do this? One full example (e.g. create config file, installing config file, using config file) would be sufficient to help me. Right now I can build the large project fine on Linux but on Windows I am having trouble of telling Curly where Larry is installed. Stephen ___ 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] CTest examples
> From: cmake-boun...@cmake.org on behalf of Ryan Pavlik > Sent: Mon 7/12/2010 9:59 AM > To: cmake@cmake.org > Subject: Re: [CMake] CTest examples > > I'm been using Boost Test, and I've written a module that lets you add the > executable and the tests (where > possible, individual named tests) with a single command - see my github > repositories for projects that include > this module. > http://github.com/rpavlik What is the name of your module? Stephen Stephen Torri, PhD NAVAL SURFACE WARFARE CENTER DAHLGREN 17214 Ave B Suite 121 Dahlgren, Va. 22448 540-653-1082 I am not a contracting officer. I cannot modify or initiate contracts, nor do I have the authority to financially commit the government in any 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
[CMake] CPack: removing NSI "Install Options" and "Choose Start Menu Folder" pages from installation wizard
I am trying to remove the "Install Options" and "" page from the install script. The "Install Options" is not required since I do not plan on adding this project installation directory to the system PATH environment variable. Also since I am installing a static library I don't see the need for adding a Start Menu entry. I was wondering if anyone had code example that would help me. Stephen ___ 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] Question about installing static libraries made with VS 2008
I have a question about building a project with static libraries. If you have a set up like the following will the final static library be the only thing that you install? I found that there was still unresolved external symbols when I only linked against Fruit.lib in the test program. (project 1 - static) add_library ( Apple STATIC ${Apple_SOURCES} ${Apple_HEADERS} ) (project 2 - static) add_library ( Pear STATIC ${Pear_SOURCES} ${Pear_HEADERS} ) (project 3 - static) add_library ( Orange STATIC ${Orange_SOURCES} ${Orange_HEADERS} ) (project 4) add_library ( Fruit STATIC ${Fruit_SOURCES} ${Fruit_HEADERS} ) target_link_libraries ( Fruit Apple Pear Orange ) My expectation was that I would have only one static library in the end called Fruit.lib with all the symbols of Apple, Pear, Orange and Fruit in it. That is what I see for a project that I build on a Linux system using Automake, Autoconf and Libtool. In the end on the Linux system I have only one static library that I need to install. So my question is: 1. Do I need only to install Fruit.lib from the given project above to get all the symbols in the project? Stephen ___ 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] Unable to add doxygen to build package for NSIS
I am trying to add doxygen output to my installation package made via NSIS. I want to allow the user to install the C++ API documentation. I would like the install page of the NSIS wizard to look like: Development | C++ Headers | Documentation Runtime | Libraries Right now I don't see the "Documentation" option. So I will lay out my setup below. What am I doing wrong that I don't see "Documentation" on the "Choose Component" page? Stephen Parent CMakeLists.txt #- # CPACK #- #- # CPACK DESCRIPTION INFORMATION #- SET(CPACK_PACKAGE_NAME "Project") SET(CPACK_PACKAGE_VENDOR "Work") SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Project text") SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/ReadMe.txt") SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt") SET(CPACK_PACKAGE_VERSION "0.2.0") SET(CPACK_PACKAGE_VERSION_MAJOR "0") SET(CPACK_PACKAGE_VERSION_MINOR "2") SET(CPACK_PACKAGE_VERSION_PATCH "0") SET(CPACK_PACKAGE_INSTALL_DIRECTORY "Project ${CPACK_PACKAGE_VERSION}") #- # DOCUMENTATION #- find_package ( Doxygen ) IF(DOXYGEN) ADD_SUBDIRECTORY(documentation) ELSE(DOXYGEN) MESSAGE(STATUS "WARNING: Doxygen not found - API documentation not created") ENDIF(DOXYGEN) #- # INSTALLATION INFORMATION #- SET(CPACK_COMPONENTS_ALL libraries devel) SET(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "Libraries") SET(CPACK_COMPONENT_LIBRARIES_DESCRIPTION "Dynamic library used to build programs with Interface") SET(CPACK_COMPONENT_DEVEL_DISPLAY_NAME "C++ Headers") SET(CPACK_COMPONENT_DEVEL_DESCRIPTION "C++ header files for use with Interface") SET(CPACK_COMPONENT_DEVEL_DEPENDS libraries) SET(CPACK_COMPONENT_DOCS_DISPLAY_NAME "C++ API Documentation") SET(CPACK_COMPONENT_DOCS_DESCRIPTION "C++ API HTML files describing the API for Interface") SET(CPACK_COMPONENT_LIBRARIES_GROUP "Runtime") SET(CPACK_COMPONENT_DEVEL_GROUP "Development") SET(CPACK_COMPONENT_DOCS_GROUP "Development") SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "All of the tools necessary to develop against the Interface") #- # INSTALLATION TYPES #- SET(CPACK_ALL_INSTALL_TYPES Full Runtime Developer) SET(CPACK_COMPONENT_LIBRARIES_INSTALL_TYPES Full Developer Runtime) SET(CPACK_COMPONENT_DEVEL_INSTALL_TYPES Full Developer) SET(CPACK_COMPONENT_DOCS_INSTALL_TYPES Full Developer) IF (WIN32) SET(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}InstallIcon.bmp") SET(CPACK_NSIS_MODIFY_PATH ON) SET(CPACK_GENERATOR "NSIS") ELSE (UNIX) SET(CPACK_GENERATOR "STGZ;TGZ;RPM") ENDIF(WIN32) # Always include this last. INCLUDE(CPack) Documentation CMakeLists.txt # prepare doxygen configuration file configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) # add doxygen as target add_custom_target(doxygen ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) # cleanup $build/api-doc on "make clean" set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES api-doc) # add doxygen as dependency to doc-target get_target_property(DOC_TARGET doc TYPE) if(NOT DOC_TARGET) add_custom_target(doc) endif() add_dependencies(doc doxygen) # install HTML API documentation and manual pages set(DOC_PATH "share/doc/${CPACK_PACKAGE_NAME}-${VERSION}") install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/api-doc/html DESTINATION ${DOC_PATH} COMPONENT docs ) IF(UNIX) # install man pages into packages, scope is now project root.. install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/api-doc/man/man3 DESTINATION share/man/man3/ ) ENDIF(UNIX ___ 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] How to install a shared library on a windows system
> From: cmake-boun...@cmake.org on behalf of Ryan Pavlik > Sent: Fri 6/11/2010 12:34 PM > To: cmake@cmake.org > Subject: Re: [CMake] How to install a shared library on a windows system > > > Stephen, > > The catch is that windows searches for the DLL at runtime in specific > locations: http://msdn.microsoft.com/en-us/library/7d83bc18%28VS.80%29.aspx I see that it searches the directories listed in the PATH variable. How can you tell CPACK to just always install itself to the PATH variable instead of asking? > This is why, when you do an install(TARGETS some-shared-libyou need > both the RUNTIME DESTINATION (for the dll) and the ARCHIVE DESTINATION > (for the import library). Generally, to avoid headaches, just put the > DLL in the same directory as the .exe. I tend to set things up like > this, if I had an executable and a shared library (which is needed by > the exe, but also might be compiled against so we should install the > import lib and headers if requested): > > install(TARGETS MyEXETarget > RUNTIME DESTINATION bin COMPONENT runtime) > > install(TARGETS MySharedLibTarget > EXPORT mysoftware-sdk > RUNTIME DESTINATION bin COMPONENT runtime > ARCHIVE DESTINATION lib COMPONENT devel > PUBLIC_HEADER DESTINATION include COMPONENT devel) Thanks for the examples. Stephen ___ 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 install a shared library on a windows system
I am running into a problem with a project that installs a shared library. The files for the project are all places in the correct directories. What I am finding is that when I compile a project with uses the shared library it compiles and links correctly but the library is not found when the executable is started. Here is my CPACK configuration for the project. Q 1: Am I missing some command that is suppose to tell windows that in my installation directory is another shared library it should use? Q 2: How can I skip the page in the NSIS wizard to not ask the user if they want to add an entry to the start menu? Q 3: As a library do I need to have a page in the NSIS wizard asking the user if they want to add the installation directory to the system PATH? I thought that only applies to executables. This project does not install any EXE files. Stephen -- #- # CPACK #- #- # CPACK DESCRIPTION INFORMATION #- SET(CPACK_PACKAGE_NAME "Project") SET(CPACK_PACKAGE_VENDOR "Work") SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Does something") SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/ReadMe.txt") SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt") SET(CPACK_PACKAGE_VERSION "0.2.0") SET(CPACK_PACKAGE_VERSION_MAJOR "0") SET(CPACK_PACKAGE_VERSION_MINOR "2") SET(CPACK_PACKAGE_VERSION_PATCH "0") SET(CPACK_PACKAGE_INSTALL_DIRECTORY "PROJECT ${CPACK_PACKAGE_VERSION}") #- # INSTALLATION INFORMATION #- SET(CPACK_COMPONENTS_ALL libraries headers) SET(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "Libraries") SET(CPACK_COMPONENT_LIBRARIES_DESCRIPTION "Dynamic library used to build programs with Project interface") SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ Headers") SET(CPACK_COMPONENT_HEADERS_DESCRIPTION "C++ header files for use with Project interface") SET(CPACK_COMPONENT_HEADERS_DEPENDS libraries) SET(CPACK_COMPONENT_LIBRARIES_GROUP "Development") SET(CPACK_COMPONENT_HEADERS_GROUP "Development") SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "All of the tools necessary to develop against the Project interface") #- # INSTALLATION TYPES #- SET(CPACK_ALL_INSTALL_TYPES Full Developer) SET(CPACK_COMPONENT_LIBRARIES_INSTALL_TYPES Full Developer) SET(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Full Developer) IF (WIN32) SET(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}InstallIcon.bmp") SET(CPACK_NSIS_MODIFY_PATH ON) SET(CPACK_GENERATOR "NSIS") ELSE (UNIX) SET(CPACK_GENERATOR "STGZ;TGZ;RPM") ENDIF(WIN32) # Always include this last. INCLUDE(CPack) Stephen Torri, PhD NAVAL SURFACE WARFARE CENTER DAHLGREN 17214 Ave B Suite 121 Dahlgren, Va. 22448 540-653-1082 I am not a contracting officer. I cannot modify or initiate contracts, nor do I have the authority to financially commit the government in any 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] dependency problem
> From: cmake-boun...@cmake.org on behalf of Yifei Li > Sent: Tue 6/8/2010 4:15 PM > To: cmake@cmake.org > Subject: Re: [CMake] dependency problem > > Thank you for reply. > > I already tried that. I think the problem was caused by 'find_library' in my > plugin's CMakeLists.txt, because it failed to find > MyLib > > I use a variable to hold the result of 'find_library' and that variable is > in turn used in target_link_libraries Assuming both "MyLib" and the plugin exist in the same project I could do this (CMakeLists.txt for MyLib) add_library ( MyLib SHARED ${SOURCE}) (CMakeLists.txt for plugin) add_dependencies ( MyLib ) add_library ( plugin SHARED ${SOURCE} ) target_link_libraries ( plugin MyLib ) I don't see you needing to use find_library. That is intended to find a library external to the existing project. It should not be necessary to find a library internal to a project. Stephen ___ 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] Building multiple releases for a visual studio project
> From: John Drescher [mailto:dresche...@gmail.com] > Sent: Tue 6/8/2010 3:55 PM > To: Torri, Stephen CIV NSWCDD, W15 > Cc: cmake@cmake.org > Subject: Re: [CMake] Building multiple releases for a visual studio project > > > On Tue, Jun 8, 2010 at 2:52 PM, Torri, Stephen CIV NSWCDD, W15 > > wrote: > > I was wondering if it was possible to have a CMake project that builds a > > Microsoft Visual Studio Project produce an > > NSIS installer for each kind of build (e.g. debug, release, RelWithDebug). > > Right now I can build the project via Visual > > Studio for all the build types which is great. Now I would like to have one > > NSIS installer for each type. Is that possible? > > > Copy the package then switch the build type in visual studio and then > run package. The file overwrites the previous nsis package with the > same name but I am pretty sure it builds for the current > configuration. I see I can do "cpack -G NSIS -C Debug ../" from my build directory to get it to produce a NSIS file for the debug version. It would be nice to be able to set a name for each release build in the top CMakeLists.txt file. So you could have something like: Append project name allow option to override default name. - CPACK_PACKAGE_NAME - works the same as it does now to provide a name for the package. For each build append the name of the release to the name. For example CPACK_PACKAGE_NAME = "MyLib" If I do "cpack -C Debug" then I get a package with the name MyLib-0.0.1-win32-Debug.exe Now if I provide a CPACK_PACKAGE_NAME_APPENDIX_ then use the provided string as an appendix to the package name. If this is not present then use the default name. Therefore if I provide: CPACK_PACKAGE_NAME_APPENDIX_DEBUG = "dbg" I would get MyLib-0.0.1-win32-dbg.exe if I did the same cpack command above. Its an idea. This way you could write a script to build all the package types you want from the command line. Stephen ___ 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] dependency problem
> From: cmake-boun...@cmake.org on behalf of Yifei Li > Sent: Tue 6/8/2010 3:23 PM > To: cmake@cmake.org > Subject: [CMake] dependency problem > > Hi folks, > > I'm new to cmake, can anyone help me with the following situation: > > I have a project which will generate following targets: 1) the application > and a shared library, say MyLib. 2) some > plugins(which are also shared libraries) that need to link MyLib, each plugin > has its own cmakelists.txt > > The problem is when CMakeLists.txt for a plugin is parsed, MyLib does not > exist. > > What is the correct way to handle this situation? So the plugin depends on MyLib. I would look at adding a add_dependcies to the plugin CMakeLists.txt. http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:add_dependencies Stephen ___ 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] Building multiple releases for a visual studio project
I was wondering if it was possible to have a CMake project that builds a Microsoft Visual Studio Project produce an NSIS installer for each kind of build (e.g. debug, release, RelWithDebug). Right now I can build the project via Visual Studio for all the build types which is great. Now I would like to have one NSIS installer for each type. Is that possible? Stephen ___ 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] How to see the generated compiler commands?
> From: cmake-boun...@cmake.org on behalf of Felipe Sodré Silva > Sent: Tue 6/8/2010 12:43 PM > To: cmake@cmake.org > Subject: [CMake] How to see the generated compiler commands? > > > Hi, I wrote a cmake script that generates a unix makefile for a project, and > I'd like to know if there's an easy > way to see the compiler arguments the make system is using to build the > project. Looking at the generated > Makefile doesn't seem to be an option. Yes there is. To see what is being done do the following: make VERBOSE=1 Stephen ___ 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] CPack: debugging project.nsi file - unknown variable
Now that I have a libraries being linked in correctly its time to move to using CPack. The cpack utility failed to execute "makensis.exe project.nsi". When I looked in the NSISOutput.log I see a few warnings: warning: unknown variable/constant "{headers}" detected, ignoring (macro:Deselect_required_by_libraries:1) warning: unknown variable/constant "{headers}" detected, ignoring (macro:Deselect_required_by_libraries:4) Followed by some errors: Error in macro Deselect_required_by_libraries on macroline 5 Error in macro MaybeSelectionChanged on macroline 10 Error in macro SectionList on macroline 3 Error in script "project.nsi" on line 831 -- aborting creation process After look at the script I found the first offending macro: !macro Deselect_required_by_libraries SectionGetFlags ${headers} $0 IntOp $1 ${SF_SELECTED} ~ IntOp $0 $0 & $1 SectionSetFlags ${headers} $0 IntOp $headers_selected 0 + 0 !macroend I must have failed to set something up in either the project CMakeLists.txt file or a child project. Where is ${headers} defined? In my project's CMakeLists.txt files I typically grouped my headers by: FILE (GLOB HEADERS *.h) Which then I used that variable in the file as: add_library ( child ${SOURCE} ${HEADERS} ) INSTALL ( FILES ${HEADERS} DESTINATION include/${PROJECT_NAME}/child ) The INSTALL line was written for Linux so I will have to change that for Windows. I would want the headers to be installed in the installation directory on Windows like: C:\Program Files\Project\include I am not sure what files are best to send to help debug this problem. Stephen Stephen Torri, PhD NAVAL SURFACE WARFARE CENTER DAHLGREN 17214 Ave B Suite 121 Dahlgren, Va. 22448 540-653-1082 I am not a contracting officer. I cannot modify or initiate contracts, nor do I have the authority to financially commit the government in any 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] Different configurations for Debug and Release
> From: Michael Wild [mailto:them...@gmail.com] > Sent: Tue 6/8/2010 9:05 AM > To: Torri, Stephen CIV NSWCDD, W15 > Cc: cmake@cmake.org > Subject: Re: [CMake] Different configurations for Debug and Release > > > > In my project the external libraries I use have the debug library files are > > in a different directory from the release versions. > > I don't think I can > > use target_link_libraries to include a path as well as the name. In > > documentation I would use > > link_directories but there is no way in the > > syntax to distinguish a debug directory from a release directory. I am > > trying > > to generate a Visual Studio project that can build a debug > > release if I select "Debug" in the configuration manager drop > > down menu > > or "Release". Is there a way for me to tell CMake that a certain set of > > directories the linker should use to > > search for files for the debug > > build versus another? > > > > Stephen > > > > Either use > > target_link_libraries( debug optimized general > ) > > or, for more control, create an imported library (add_library( > IMPORTED)) and set the > IMPORTED_LOCATION_ target properties to > specify the location on the disk for each of the configurations > you want to > handle. I did not think that I could use a full path to a library in the TARGET_LINK_LIBRARIES. Is that right? I don't think what you suggest will work: TARGET_LINK_LIBRARIES ( ${Boost_LIBRARIES} ${MYSQLCPPCONNECTOR_LIB_DIR}/debug/mysqlcppconn-static.lib ) So I was looking at add_library. I am not sure I get the IMPORTED_LOCATION_. First off what can I use for ? I tried IMPORTED_LOCATION_DEBUG but that gave me an error from cmake-gui saying its was an unknown cmake command. The documentation does not clearly define what is other than stating its a configuration. Can you provide a simple example of what you are suggesting? Stephen ___ 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] Different configurations for Debug and Release
> From: cmake-boun...@cmake.org on behalf of Tyler Roscoe > Sent: Mon 6/7/2010 4:25 PM > To: Felipe Sodré Silva > Cc: cmake@cmake.org > Subject: Re: [CMake] Different configurations for Debug and Release > > > On Mon, Jun 07, 2010 at 03:04:02PM -0300, Felipe Sodré Silva wrote: > > The CXX_FLAGS part seems to work (I needed the LINK_FLAGS_RELEASE), but I > > also need to include a library (through target_link_libraries) if and only > > if I am building a release version. Is that possible? > > Look at the debug and optimized flags for target_link_libraries(). In my project the external libraries I use have the debug library files are in a different directory from the release versions. I don't think I can use target_link_libraries to include a path as well as the name. In documentation I would use link_directories but there is no way in the syntax to distinguish a debug directory from a release directory. I am trying to generate a Visual Studio project that can build a debug release if I select "Debug" in the configuration manager drop down menu or "Release". Is there a way for me to tell CMake that a certain set of directories the linker should use to search for files for the debug build versus another? Stephen ___ 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] try_compile question
> > From: cmake-boun...@cmake.org on behalf of Mark Moll > Sent: Mon 6/7/2010 12:57 PM > To: cmake@cmake.org > Subject: [CMake] try_compile question > > /opt/local/bin/c++-isysroot /Developer/SDKs/MacOSX10.5.sdk > -mmacosx-version-min=10.5 -o > CMakeFiles/cmTryCompileExec.dir/CheckSZencoder.cpp.o -c > /Users/mmoll/CMakeModules/CheckSZencoder.cpp > /Users/mmoll/CMakeModules/CheckSZencoder.cpp:2:19: error: szlib.h: No such > file or directory It appears you do not have either the include directories set correctly or szlib.h is not installed. Stephen ___ 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] Help creating a module for detecting mysql-connector-c++
I am revisiting the FindMysqlCppConnector.cmake file now that I have other problems solved. What I cannot determine is how to tell cmake to tell me all the path combinations it used to search for the MySQL Connector/C++ header and library files. The script you gave is attached. I am getting the follow messages from it: CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:70 (MESSAGE): Could NOT find MysqlConnectorCpp (missing: MYSQLCONNECTORCPP_INCLUDE_DIR MYSQLCONNECTORCPP_LIBRARY) Call Stack (most recent call first): cmake/Modules/FindMysqlConnectorCpp.cmake:65 (find_package_handle_standard_args) CMakeLists.txt:31 (find_package) Configuring incomplete, errors occurred! Stephen FindMysqlConnectorCpp.cmake Description: FindMysqlConnectorCpp.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] Help creating a module for detecting mysql-connector-c++
> From: Ryan Pavlik [mailto:rpav...@iastate.edu] > Sent: Wed 5/26/2010 5:37 PM > To: Torri, Stephen CIV NSWCDD, W15; cmake@cmake.org > Subject: Re: [CMake] Help creating a module for detecting mysql-connector-c++ > > No, the "ROOT_DIR" variables are to be set by the user at configure time > - let's say you installed something into a weird directory, you'd like > to be able to tell it where to find it. You wouldn't generally set it > in your cmakelists.txt, except if you know a relative location (for > example, there is no PARTB_ROOT_DIR set, but it's always bundled with > PARTA, and you have a PARTA_ROOT_DIR, you might consider setting > PARTB_ROOT_DIR to be the value of PARTA_ROOT_DIR) Ryan, Ok. I see that its now an entry in the cmake-gui. What I filled in the file with the directory where mysql-connector-c++ is installed but I could not figure out why it failed to find it. The headers are found in "C:\Program Files\MySQL\MySQL Connector C++ 1.0.5\include\cppconn" so I changed the find_path for the include to be: find_path(MYSQLCONNECTORCPP_INCLUDE_DIR NAMES mysql_connection.h PATHS "cppconn" HINTS ${MYSQLCONNECTORCPP_ROOT_DIR} PATH_SUFFIXES include) Where I think I am getting confused is how this command is expanded. In particular I would like to follow what is doing by running this module in some sort of debug mode. That is print out the paths it looked into to find the target header. Stephen ___ 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 - library help
> From: Doug Reiland [mailto:dreil...@gmail.com] > Sent: Thu 5/27/2010 12:48 PM > To: Torri, Stephen CIV NSWCDD, W15 > Subject: Re: [CMake] cmake - library help > > ok, I think I have this working, thanks. > I am building static version of "foo" as well. > Before, I could just archive in this composite object. > How is the best way to do that? I would post your question to the mailing list. I am in the same boat attempting to learn cmake. My experience is with Automake/Autoconf and Visual Studio. So I would like to know the answer myself. > Here is my current cmake pseudo-code of what I have come up with? > Note, SOURCES has list of files adding to shared lib > > set SOURCES-static ${SOURCES} > file(GLOB subdira-sources subdira/*.c) > list(APPEND SOURCES-static ${subdira-sources}) > > then > add_library(foo-static STATIC ${SOURCES-static}) > > I have several composite objects like this.Is there a better way? Personally I add my files to a variable called SOURCES by hand. Although it does make the CMakeLists.txt file longer than a glob you gain the ability of CMAKE to track dependencies of the new file (see http://stackoverflow.com/questions/1027247/best-way-to-specify-sourcefiles-in-cmake). Thinking about it for a few seconds I think we can come up with a few principles to guide our use of GLOB or manual file entry. Principle 1 - Everything is source. If everything is compiled in a directory then using FILE ( GLOB *. ) seems to be the best choice. The negative of this principle is that the directory cannot have files for another purpose thereby requiring the use of LIST ( REMOVE_ITEM ). Personally I would recommend a directory for each project. Principle 2 - Only something are source. If only some things are source then you have two approaches. Approach 1 - Use SET ( In the end the principle need to fit your development style. I like to keep things seperated into directories with names that explain their purpose. Its a way to idiot proof my life. Not everyone does that which is fine. There is no simple hard fast rule that we need to follow. If it is maintainable to your team then keep doing they way you have been. Stephen ___ 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 - library help
> From: cmake-boun...@cmake.org on behalf of Doug Reiland > Sent: Thu 5/27/2010 11:14 AM > To: cmake@cmake.org > Subject: [CMake] cmake - library help > > First, I am new to cmake and exploring converting our home grown build system. > How would I code this up in cmake > I have composite objects that need to be added to a share library > add_library(foo a.c b.c c.c) Use the keyword 'SHARED' to indicate you need shared library: add_library (foo SHARED a.c b.c c.c) > I also need x.o in the library AND x.o linked from: > subdir-a/aa.c subdir-a/bb.c If the subdirectories have a project named in a CMakeLists.txt you can just tell cmake to link the library in: So if subdir-a has a project like: cmake_minimum_required(VERSION 2.6) add_library (subA aa.c bb.c ) then you can link subA inside the other project. For example say the 'foo' library needs to statically link in subA. add_library ( foo SHARED a.c b.c c.c) link_libraries ( subA ) Stephen ___ 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] Problems building a shared library
I am attempting to build a shared library as a project. In order to explain my project I will use a pseudo project with a similar setup. The library is called TruckInterface with four directories (Wheels, Engine, Frame and Truck). The directories Wheels, Engine and Frame are built as static libraries and Truck is a shared library to be installed. TruckInterface |--- Wheels |--- Engine |--- Frame |--- Truck In the CMakeLists.txt for Wheels, Engine and Frame I have followed the format below: SET ( HEADERS ..list header files ) SET ( SOURCES ...list source files ) INCLUDE_DIRECTORIES ( ...other directory to look for headers in the project... ) add_library ( STATIC ${SOURCES} ${HEADERS} ) In the CMakeLists.txt for Truck I have SET ( HEADERS ..list header files ) SET ( SOURCES ...list source files ) INCLUDE_DIRECTORIES ( ...other directory to look for headers in the project... ) add_library ( Truck SHARED ${SOURCES} ${HEADERS} ) link_libraries ( Wheels Engine Frame ) Now my problems that I am coming across, some of which are not cmake's fault: 1. Undefined references even though the code has been declared for member functions 2. Unable to set global compiler flags in the CMakeLists in the TruckInterface directory 3. How to select when I want a debug versus a release build. My experience is using Automake/Autoconf on Linux and Visual Studio on Windows. I would appreciate help on points 2 and 3 but would like advice on how to debug point 1. Stephen ___ 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] Help creating a module for detecting mysql-connector-c++
> From: Ryan Pavlik [mailto:rpav...@iastate.edu] > Sent: Wed 5/26/2010 2:42 PM > To: Torri, Stephen CIV NSWCDD, W15; cmake@cmake.org > Subject: Re: [CMake] Help creating a module for detecting mysql-connector-c++ > > Didn't test it, just ran it through my cleanup software and then tweaked > it a bit by hand. Hopefully this should help - at the very least it > will be more readable and standardized. > > With this, you should just be able to set a MYSQLCONNECTORCPP_ROOT_DIR > and have it find the rest properly and automatically, marking as > advanced when possible. > > Ryan What software are you using to clean up a CMakeLists.txt file? Thanks for the help. Stephen ___ 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] Help creating a module for detecting mysql-connector-c++
I am trying to create a connector for finding mysql-connector-c++. This is a C++ library that allows a C++ application or library connect to a MySQL server. Right now it works fine on Linux but fails to locate the mysql-connector-c++ library installed on a XP 64-bit machine. On the Linux system the headers are located in /usr/include and the libraries are in /usr/lib. On the Windows system the location is not as easy to locate since the user can place them pretty much anywhere. At present they are installed in C:\Program Files\MySQL\MySQL Connector C++ 1.0.5. When I configure the project via the CMake-gui on Windows it reports that MysqlConnectorCpp_INCLUDE_DIR and MysqlConnectorCpp_LIBRARIES are NOTFOUND. Here is my module as it stands right now. Am I doing something wrong on the Windows side? Stephen -- # - Try to find Mysql-Connector-C++ # Once done, this will define # # MysqlConnectorCpp_FOUND - system has Mysql-Connector-C++ installed # MysqlConnectorCpp_INCLUDE_DIRS - the Mysql-Connector-C++ include directories # MysqlConnectorCpp_LIBRARIES - link these to use Mysql-Connector-C++ SET (MysqlConnector_Cpp_FOUND FALSE) IF (WIN32) FIND_PATH(MysqlConnectorCpp_INCLUDE_DIR NAMES mysql_connection.h PATHS "C:\\Program Files" ) FIND_LIBRARY(MysqlConnectorCpp_LIBRARY mysqlcppconn) FIND_LIBRARY(MysqlConnectorCpp_LIBRARY mysqlcppconn-static) ELSE(WIN32) FIND_PATH(MysqlConnectorCpp_INCLUDE_DIR mysql_connection.h /opt/include /usr/local/include /usr/include ) FIND_LIBRARY(MysqlConnectorCpp_LIBRARY NAMES mysqlcppconn mysqlcppconn-static PATHS /opt/lib /usr/local/lib /usr/lib ) ENDIF(WIN32) IF(MysqlConnectorCpp_LIBRARY) SET(MysqlConnectorCpp_FOUND "YES") ENDIF(MysqlConnectorCpp_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] Post-Generate commands
> From: cmake-boun...@cmake.org on behalf of LaViolette, Alan > Sent: Wed 5/26/2010 1:05 PM > To: a.neundorf-w...@gmx.net; cmake@cmake.org > Subject: Re: [CMake] Post-Generate commands > > I want to run at the end of cmake. I am generating some additional > files that are more complex then configure can do. But I need the > generated projects and solutions. So as I understand what you are saying is that you want 1. CMake to generate its files 2. Run extra command after its done If so it sounds like you need a shell script or batch file depending on your platform. Stephen ___ 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