https://public.kitware.com/Wiki/api.php?action=feedcontributions&user=JedBrown&feedformat=atomKitwarePublic - User contributions [en]2024-03-29T12:37:08ZUser contributionsMediaWiki 1.38.6https://public.kitware.com/Wiki/index.php?title=CMake:Improving_Find*_Modules&diff=14689CMake:Improving Find* Modules2009-02-25T16:55:09Z<p>JedBrown: Issues with static libraries</p>
<hr />
<div>On the CMake mailing list there was a long discussion on how to improve the Find* modules in CMake. Currently (CMake 2.6.2), there are several issues with the Find* modules that cause trouble on some configurations. See this thread :[http://www.cmake.org/pipermail/cmake/2008-November/025131.html]<br />
<br />
== Problems with current Find* modules ==<br />
<br />
<br />
* Finding packages in non-standard locations can be difficult and is not standardized across all the Find* modules.<br />
<br />
* The parsing and use of pkg-config, and other config tools does not always find the full paths to libraries that are required for the build.<br />
<br />
* Often times a Find* module has a key variable that when changed should cause CMake to re-discover many other cached variables. Currently, there is no uniform way to do this in CMake<br />
<br />
* If multiple ABI's exist on a machine, CMake may find a .so or .a library that will not work with the rest of the libraries found or with the compiler and flags picked.<br />
<br />
* Often libraries are linked with static libraries in which case the recursive dependencies must be linked. These dependencies may depend on how the interface library was configured.<br />
<br />
== Proposed solutions to Find* issues ==<br />
<br />
<br />
=== Packages in unusual locations ===<br />
Each module should have an environment variable that is looked at first, much like the CC and CXX environment variables do for the compiler tool chain discovery. Once the module finds the package based on the environment variable, a CMake cache variable of the same name should be created. If the environment variable is present, but the software is NOT found, then the module should stop looking and report the package not found. <br />
<br />
<br />
=== Converting -L/-l flags ===<br />
Add ability to parse compile lines like the ones produced from pkg-config and turn them into full paths to libraries. So, turn -L/my/path -lfoo into /my/path/libfoo.a.<br />
<br />
(Then I thought that this might be easy, so I tried to code this as a CMake module, but I encountered some complications and marked them with FIXME. --[[User:Kernigh|Kernigh]] 22:17, 26 December 2008 (UTC))<br />
<br />
Module in file ''ConvertLibraryFlags.cmake'':<br />
<br />
<pre><br />
#- convert from -L and -l flags to full paths of libraries<br />
# convert_library_flags(<variable> [flags ...])<br />
#<br />
# Given some compiler flags, replace the -L... and -l... flags with full<br />
# paths to libraries, and store the result into <variable>. This is<br />
# useful for converting the output from scripts like pkg-config.<br />
#<br />
# FIXME - put an example here!<br />
<br />
function(convert_library_flags variable)<br />
<br />
# grab libdirs from the -L flags<br />
set(libdirs)<br />
foreach(flag ${ARGN})<br />
if(flag MATCHES "^-L")<br />
# chop -L and append to libdirs<br />
string(REGEX REPLACE "^-L(.*)$" "\\1" dir ${flag})<br />
list(APPEND libdirs ${dir})<br />
endif()<br />
endforeach(flag)<br />
<br />
# now convert flags to result<br />
set(result)<br />
foreach(flag ${ARGN})<br />
if(flag MATCHES "^-L")<br />
# do nothing, removes -L flags from result<br />
elseif(flag MATCHES "^-l")<br />
# chop -l<br />
string(REGEX REPLACE "^-l(.*)$" "\\1" lib ${flag})<br />
<br />
# We cannot use find_library, because we do not want a cache<br />
# variable. So do the search manually. This uses three nested<br />
# foreach loops (for dir, prefix, suffix).<br />
#<br />
# FIXME - Where does the compiler look for libraries, when<br />
# there is no -L flag? Assuming /usr/lib and /usr/local/lib<br />
# but this is wrong and nonportable.<br />
#<br />
# FIXME - This fails to find shared libraries in OpenBSD,<br />
# because of no "*.so" symlinks without a version number.<br />
#<br />
set(go TRUE)<br />
foreach(dir ${libdirs} /usr/lib /usr/local/lib)<br />
foreach(prefix ${CMAKE_FIND_LIBRARY_PREFIXES})<br />
foreach(suffix ${CMAKE_FIND_LIBRARY_SUFFIXES})<br />
if(go)<br />
set(file ${dir}/${prefix}${lib}${suffix})<br />
if(EXISTS ${file})<br />
# found it! append to result<br />
list(APPEND result ${file})<br />
set(go FALSE) # break from nested loops<br />
endif()<br />
endif()<br />
endforeach(suffix)<br />
endforeach(prefix)<br />
endforeach(dir)<br />
<br />
if(go)<br />
message(SEND_ERROR "library for flag ${flag}: not found")<br />
endif(go)<br />
<br />
else()<br />
# Flag is not -L or -l, might be something like -pthread, so<br />
# just preserve it.<br />
list(APPEND result ${flag})<br />
endif()<br />
endforeach(flag)<br />
<br />
# return the result<br />
set("${variable}" ${result} PARENT_SCOPE)<br />
<br />
endfunction(convert_library_flags)<br />
</pre><br />
<br />
Here is an example:<br />
<br />
<pre><br />
# test-CLF/CMakeLists.txt<br />
<br />
cmake_minimum_required(VERSION 2.6)<br />
project(test-CLF C)<br />
<br />
include(${CMAKE_SOURCE_DIR}/../ConvertLibraryFlags.cmake)<br />
<br />
function(getflags variable)<br />
# quick hack, does not check exit status or standard error<br />
execute_process(COMMAND ${ARGN} OUTPUT_VARIABLE output)<br />
<br />
# I would use separate_arguments, but I also need to chomp<br />
# the \n at end of output.<br />
string(REGEX REPLACE "[ \t\n]+" \; output "${output}")<br />
<br />
set("${variable}" ${output} PARENT_SCOPE)<br />
endfunction(getflags)<br />
<br />
getflags(png pkg-config libpng --libs)<br />
getflags(xv pkg-config xv --libs)<br />
message("PNG libs: ${png}")<br />
message("XVideo libs: ${xv}")<br />
<br />
convert_library_flags(fullpng ${png})<br />
convert_library_flags(fullxv ${xv})<br />
message("PNG libs (full paths): ${fullpng}")<br />
message("XVideo libs (full paths): ${fullxv}")<br />
</pre><br />
<br />
Which gave this output for an OpenBSD system with installed X11 and libpng:<br />
<br />
<pre><br />
PNG libs: -L/usr/local/lib;-lpng;-lz;-lm<br />
XVideo libs: -L/usr/X11R6/lib;-lXv;-lXext;-lX11;-lXdmcp;-lXau<br />
PNG libs (full paths): /usr/local/lib/libpng.a;/usr/lib/libz.a;/usr/lib/<br />
libm.a<br />
XVideo libs (full paths): /usr/X11R6/lib/libXv.a;/usr/X11R6/lib/libXext.<br />
a;/usr/X11R6/lib/libX11.a;/usr/X11R6/lib/libXdmcp.a;/usr/X11R6/lib/libXa<br />
u.a<br />
</pre><br />
<br />
=== Dependent cache variables ===<br />
Add an easy way to create dependent cache variables, that when changed unset a number of other variables. Something like this:<br />
<br />
check_cache_depend(VAR1 DVAR1 DVAR2 DVAR3 DVAR4)<br />
<br />
If VAR1 changes in the cache from a previous value, then DVAR1, DVAR2, DVAR3, and DVAR4 are all removed from the cache. You would put something like that at the top of a FindFoo.cmake module. For Qt it would be:<br />
<br />
check_cache_depend(QT_QMAKE_EXECUTABLE QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR<br />
QT_QTDESIGNERCOMPONENTS_LIBRARY_RELEASE ...)<br />
<br />
Note: it is possible to have more than one variable which should trigger a rebuild. An attempt to handle this is [http://github.com/jedbrown/cmake-modules/blob/2652aca00f94f30dbb5944ba846ed0a74dc49202/FindPackageMultipass.cmake here].<br />
<br />
=== ABI issue ===<br />
For the ABI issue, a try-compile should most likely be used in each Find* module. However, ideally this would have to be integrated into the find_library command so that it would not find libraries that were of the wrong ABI. Currently, there is not a good proposal for dealing with this issue.<br />
<br />
=== Recursive linking for static libraries ===<br />
It would be helpful to have a way to specify possible recursive dependencies. For example, when linking against libtiff.a, we might also need to link against libz and/or libjpeg, depending on how libtiff was configured. Determining what is needed means attempting to link an executable. Since the results of try_compile are cached, attempting to link executables with many possible sets of libraries is particularly painful. Currently, there is not a good proposal for dealing with this issue.<br />
<br />
== Current workarounds ==</div>JedBrownhttps://public.kitware.com/Wiki/index.php?title=CMake:Improving_Find*_Modules&diff=14688CMake:Improving Find* Modules2009-02-25T16:44:59Z<p>JedBrown: /* Dependent cache variables */</p>
<hr />
<div>On the CMake mailing list there was a long discussion on how to improve the Find* modules in CMake. Currently (CMake 2.6.2), there are several issues with the Find* modules that cause trouble on some configurations. See this thread :[http://www.cmake.org/pipermail/cmake/2008-November/025131.html]<br />
<br />
== Problems with current Find* modules ==<br />
<br />
<br />
* Finding packages in non-standard locations can be difficult and is not standardized across all the Find* modules.<br />
<br />
* The parsing and use of pkg-config, and other config tools does not always find the full paths to libraries that are required for the build.<br />
<br />
* Often times a Find* module has a key variable that when changed should cause CMake to re-discover many other cached variables. Currently, there is no uniform way to do this in CMake<br />
<br />
* If multiple ABI's exist on a machine, CMake may find a .so or .a library that will not work with the rest of the libraries found or with the compiler and flags picked.<br />
<br />
* Often libraries are linked with static libraries in which case the recursive dependencies must be linked. These dependencies may depend on how the interface library was configured.<br />
<br />
== Proposed solutions to Find* issues ==<br />
<br />
<br />
=== Packages in unusual locations ===<br />
Each module should have an environment variable that is looked at first, much like the CC and CXX environment variables do for the compiler tool chain discovery. Once the module finds the package based on the environment variable, a CMake cache variable of the same name should be created. If the environment variable is present, but the software is NOT found, then the module should stop looking and report the package not found. <br />
<br />
<br />
=== Converting -L/-l flags ===<br />
Add ability to parse compile lines like the ones produced from pkg-config and turn them into full paths to libraries. So, turn -L/my/path -lfoo into /my/path/libfoo.a.<br />
<br />
(Then I thought that this might be easy, so I tried to code this as a CMake module, but I encountered some complications and marked them with FIXME. --[[User:Kernigh|Kernigh]] 22:17, 26 December 2008 (UTC))<br />
<br />
Module in file ''ConvertLibraryFlags.cmake'':<br />
<br />
<pre><br />
#- convert from -L and -l flags to full paths of libraries<br />
# convert_library_flags(<variable> [flags ...])<br />
#<br />
# Given some compiler flags, replace the -L... and -l... flags with full<br />
# paths to libraries, and store the result into <variable>. This is<br />
# useful for converting the output from scripts like pkg-config.<br />
#<br />
# FIXME - put an example here!<br />
<br />
function(convert_library_flags variable)<br />
<br />
# grab libdirs from the -L flags<br />
set(libdirs)<br />
foreach(flag ${ARGN})<br />
if(flag MATCHES "^-L")<br />
# chop -L and append to libdirs<br />
string(REGEX REPLACE "^-L(.*)$" "\\1" dir ${flag})<br />
list(APPEND libdirs ${dir})<br />
endif()<br />
endforeach(flag)<br />
<br />
# now convert flags to result<br />
set(result)<br />
foreach(flag ${ARGN})<br />
if(flag MATCHES "^-L")<br />
# do nothing, removes -L flags from result<br />
elseif(flag MATCHES "^-l")<br />
# chop -l<br />
string(REGEX REPLACE "^-l(.*)$" "\\1" lib ${flag})<br />
<br />
# We cannot use find_library, because we do not want a cache<br />
# variable. So do the search manually. This uses three nested<br />
# foreach loops (for dir, prefix, suffix).<br />
#<br />
# FIXME - Where does the compiler look for libraries, when<br />
# there is no -L flag? Assuming /usr/lib and /usr/local/lib<br />
# but this is wrong and nonportable.<br />
#<br />
# FIXME - This fails to find shared libraries in OpenBSD,<br />
# because of no "*.so" symlinks without a version number.<br />
#<br />
set(go TRUE)<br />
foreach(dir ${libdirs} /usr/lib /usr/local/lib)<br />
foreach(prefix ${CMAKE_FIND_LIBRARY_PREFIXES})<br />
foreach(suffix ${CMAKE_FIND_LIBRARY_SUFFIXES})<br />
if(go)<br />
set(file ${dir}/${prefix}${lib}${suffix})<br />
if(EXISTS ${file})<br />
# found it! append to result<br />
list(APPEND result ${file})<br />
set(go FALSE) # break from nested loops<br />
endif()<br />
endif()<br />
endforeach(suffix)<br />
endforeach(prefix)<br />
endforeach(dir)<br />
<br />
if(go)<br />
message(SEND_ERROR "library for flag ${flag}: not found")<br />
endif(go)<br />
<br />
else()<br />
# Flag is not -L or -l, might be something like -pthread, so<br />
# just preserve it.<br />
list(APPEND result ${flag})<br />
endif()<br />
endforeach(flag)<br />
<br />
# return the result<br />
set("${variable}" ${result} PARENT_SCOPE)<br />
<br />
endfunction(convert_library_flags)<br />
</pre><br />
<br />
Here is an example:<br />
<br />
<pre><br />
# test-CLF/CMakeLists.txt<br />
<br />
cmake_minimum_required(VERSION 2.6)<br />
project(test-CLF C)<br />
<br />
include(${CMAKE_SOURCE_DIR}/../ConvertLibraryFlags.cmake)<br />
<br />
function(getflags variable)<br />
# quick hack, does not check exit status or standard error<br />
execute_process(COMMAND ${ARGN} OUTPUT_VARIABLE output)<br />
<br />
# I would use separate_arguments, but I also need to chomp<br />
# the \n at end of output.<br />
string(REGEX REPLACE "[ \t\n]+" \; output "${output}")<br />
<br />
set("${variable}" ${output} PARENT_SCOPE)<br />
endfunction(getflags)<br />
<br />
getflags(png pkg-config libpng --libs)<br />
getflags(xv pkg-config xv --libs)<br />
message("PNG libs: ${png}")<br />
message("XVideo libs: ${xv}")<br />
<br />
convert_library_flags(fullpng ${png})<br />
convert_library_flags(fullxv ${xv})<br />
message("PNG libs (full paths): ${fullpng}")<br />
message("XVideo libs (full paths): ${fullxv}")<br />
</pre><br />
<br />
Which gave this output for an OpenBSD system with installed X11 and libpng:<br />
<br />
<pre><br />
PNG libs: -L/usr/local/lib;-lpng;-lz;-lm<br />
XVideo libs: -L/usr/X11R6/lib;-lXv;-lXext;-lX11;-lXdmcp;-lXau<br />
PNG libs (full paths): /usr/local/lib/libpng.a;/usr/lib/libz.a;/usr/lib/<br />
libm.a<br />
XVideo libs (full paths): /usr/X11R6/lib/libXv.a;/usr/X11R6/lib/libXext.<br />
a;/usr/X11R6/lib/libX11.a;/usr/X11R6/lib/libXdmcp.a;/usr/X11R6/lib/libXa<br />
u.a<br />
</pre><br />
<br />
=== Dependent cache variables ===<br />
Add an easy way to create dependent cache variables, that when changed unset a number of other variables. Something like this:<br />
<br />
check_cache_depend(VAR1 DVAR1 DVAR2 DVAR3 DVAR4)<br />
<br />
If VAR1 changes in the cache from a previous value, then DVAR1, DVAR2, DVAR3, and DVAR4 are all removed from the cache. You would put something like that at the top of a FindFoo.cmake module. For Qt it would be:<br />
<br />
check_cache_depend(QT_QMAKE_EXECUTABLE QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR<br />
QT_QTDESIGNERCOMPONENTS_LIBRARY_RELEASE ...)<br />
<br />
Note: it is possible to have more than one variable which should trigger a rebuild. An attempt to handle this is [http://github.com/jedbrown/cmake-modules/blob/2652aca00f94f30dbb5944ba846ed0a74dc49202/FindPackageMultipass.cmake here].<br />
<br />
=== ABI issue ===<br />
For the ABI issue, a try-compile should most likely be used in each Find* module. However, ideally this would have to be integrated into the find_library command so that it would not find libraries that were of the wrong ABI. Currently, there is not a good proposal for dealing with this issue.<br />
<br />
== Current workarounds ==</div>JedBrownhttps://public.kitware.com/Wiki/index.php?title=CMake:Improving_Find*_Modules&diff=14687CMake:Improving Find* Modules2009-02-25T16:40:50Z<p>JedBrown: /* Problems with current Find* modules */</p>
<hr />
<div>On the CMake mailing list there was a long discussion on how to improve the Find* modules in CMake. Currently (CMake 2.6.2), there are several issues with the Find* modules that cause trouble on some configurations. See this thread :[http://www.cmake.org/pipermail/cmake/2008-November/025131.html]<br />
<br />
== Problems with current Find* modules ==<br />
<br />
<br />
* Finding packages in non-standard locations can be difficult and is not standardized across all the Find* modules.<br />
<br />
* The parsing and use of pkg-config, and other config tools does not always find the full paths to libraries that are required for the build.<br />
<br />
* Often times a Find* module has a key variable that when changed should cause CMake to re-discover many other cached variables. Currently, there is no uniform way to do this in CMake<br />
<br />
* If multiple ABI's exist on a machine, CMake may find a .so or .a library that will not work with the rest of the libraries found or with the compiler and flags picked.<br />
<br />
* Often libraries are linked with static libraries in which case the recursive dependencies must be linked. These dependencies may depend on how the interface library was configured.<br />
<br />
== Proposed solutions to Find* issues ==<br />
<br />
<br />
=== Packages in unusual locations ===<br />
Each module should have an environment variable that is looked at first, much like the CC and CXX environment variables do for the compiler tool chain discovery. Once the module finds the package based on the environment variable, a CMake cache variable of the same name should be created. If the environment variable is present, but the software is NOT found, then the module should stop looking and report the package not found. <br />
<br />
<br />
=== Converting -L/-l flags ===<br />
Add ability to parse compile lines like the ones produced from pkg-config and turn them into full paths to libraries. So, turn -L/my/path -lfoo into /my/path/libfoo.a.<br />
<br />
(Then I thought that this might be easy, so I tried to code this as a CMake module, but I encountered some complications and marked them with FIXME. --[[User:Kernigh|Kernigh]] 22:17, 26 December 2008 (UTC))<br />
<br />
Module in file ''ConvertLibraryFlags.cmake'':<br />
<br />
<pre><br />
#- convert from -L and -l flags to full paths of libraries<br />
# convert_library_flags(<variable> [flags ...])<br />
#<br />
# Given some compiler flags, replace the -L... and -l... flags with full<br />
# paths to libraries, and store the result into <variable>. This is<br />
# useful for converting the output from scripts like pkg-config.<br />
#<br />
# FIXME - put an example here!<br />
<br />
function(convert_library_flags variable)<br />
<br />
# grab libdirs from the -L flags<br />
set(libdirs)<br />
foreach(flag ${ARGN})<br />
if(flag MATCHES "^-L")<br />
# chop -L and append to libdirs<br />
string(REGEX REPLACE "^-L(.*)$" "\\1" dir ${flag})<br />
list(APPEND libdirs ${dir})<br />
endif()<br />
endforeach(flag)<br />
<br />
# now convert flags to result<br />
set(result)<br />
foreach(flag ${ARGN})<br />
if(flag MATCHES "^-L")<br />
# do nothing, removes -L flags from result<br />
elseif(flag MATCHES "^-l")<br />
# chop -l<br />
string(REGEX REPLACE "^-l(.*)$" "\\1" lib ${flag})<br />
<br />
# We cannot use find_library, because we do not want a cache<br />
# variable. So do the search manually. This uses three nested<br />
# foreach loops (for dir, prefix, suffix).<br />
#<br />
# FIXME - Where does the compiler look for libraries, when<br />
# there is no -L flag? Assuming /usr/lib and /usr/local/lib<br />
# but this is wrong and nonportable.<br />
#<br />
# FIXME - This fails to find shared libraries in OpenBSD,<br />
# because of no "*.so" symlinks without a version number.<br />
#<br />
set(go TRUE)<br />
foreach(dir ${libdirs} /usr/lib /usr/local/lib)<br />
foreach(prefix ${CMAKE_FIND_LIBRARY_PREFIXES})<br />
foreach(suffix ${CMAKE_FIND_LIBRARY_SUFFIXES})<br />
if(go)<br />
set(file ${dir}/${prefix}${lib}${suffix})<br />
if(EXISTS ${file})<br />
# found it! append to result<br />
list(APPEND result ${file})<br />
set(go FALSE) # break from nested loops<br />
endif()<br />
endif()<br />
endforeach(suffix)<br />
endforeach(prefix)<br />
endforeach(dir)<br />
<br />
if(go)<br />
message(SEND_ERROR "library for flag ${flag}: not found")<br />
endif(go)<br />
<br />
else()<br />
# Flag is not -L or -l, might be something like -pthread, so<br />
# just preserve it.<br />
list(APPEND result ${flag})<br />
endif()<br />
endforeach(flag)<br />
<br />
# return the result<br />
set("${variable}" ${result} PARENT_SCOPE)<br />
<br />
endfunction(convert_library_flags)<br />
</pre><br />
<br />
Here is an example:<br />
<br />
<pre><br />
# test-CLF/CMakeLists.txt<br />
<br />
cmake_minimum_required(VERSION 2.6)<br />
project(test-CLF C)<br />
<br />
include(${CMAKE_SOURCE_DIR}/../ConvertLibraryFlags.cmake)<br />
<br />
function(getflags variable)<br />
# quick hack, does not check exit status or standard error<br />
execute_process(COMMAND ${ARGN} OUTPUT_VARIABLE output)<br />
<br />
# I would use separate_arguments, but I also need to chomp<br />
# the \n at end of output.<br />
string(REGEX REPLACE "[ \t\n]+" \; output "${output}")<br />
<br />
set("${variable}" ${output} PARENT_SCOPE)<br />
endfunction(getflags)<br />
<br />
getflags(png pkg-config libpng --libs)<br />
getflags(xv pkg-config xv --libs)<br />
message("PNG libs: ${png}")<br />
message("XVideo libs: ${xv}")<br />
<br />
convert_library_flags(fullpng ${png})<br />
convert_library_flags(fullxv ${xv})<br />
message("PNG libs (full paths): ${fullpng}")<br />
message("XVideo libs (full paths): ${fullxv}")<br />
</pre><br />
<br />
Which gave this output for an OpenBSD system with installed X11 and libpng:<br />
<br />
<pre><br />
PNG libs: -L/usr/local/lib;-lpng;-lz;-lm<br />
XVideo libs: -L/usr/X11R6/lib;-lXv;-lXext;-lX11;-lXdmcp;-lXau<br />
PNG libs (full paths): /usr/local/lib/libpng.a;/usr/lib/libz.a;/usr/lib/<br />
libm.a<br />
XVideo libs (full paths): /usr/X11R6/lib/libXv.a;/usr/X11R6/lib/libXext.<br />
a;/usr/X11R6/lib/libX11.a;/usr/X11R6/lib/libXdmcp.a;/usr/X11R6/lib/libXa<br />
u.a<br />
</pre><br />
<br />
=== Dependent cache variables ===<br />
Add an easy way to create dependent cache variables, that when changed unset a number of other variables. Something like this:<br />
<br />
check_cache_depend(VAR1 DVAR1 DVAR2 DVAR3 DVAR4)<br />
<br />
If VAR1 changes in the cache from a previous value, then DVAR1, DVAR2, DVAR3, and DVAR4 are all removed from the cache. You would put something like that at the top of a FindFoo.cmake module. For Qt it would be:<br />
<br />
check_cache_depend(QT_QMAKE_EXECUTABLE QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR<br />
QT_QTDESIGNERCOMPONENTS_LIBRARY_RELEASE ...)<br />
<br />
=== ABI issue ===<br />
For the ABI issue, a try-compile should most likely be used in each Find* module. However, ideally this would have to be integrated into the find_library command so that it would not find libraries that were of the wrong ABI. Currently, there is not a good proposal for dealing with this issue.<br />
<br />
== Current workarounds ==</div>JedBrownhttps://public.kitware.com/Wiki/index.php?title=CMake:Module_Maintainers&diff=14062CMake:Module Maintainers2008-11-09T18:27:52Z<p>JedBrown: Add my github repository (NetCDF,FFTW,GSL,PETSc,iMesh) and tools (FindPackageMultipass,ResolveCompilerPaths)</p>
<hr />
<div>If you want to add a new module to CMake, then you must volunteer to maintain it, or find someone that will. This page contains a list of Module maintainer volunteers, and instructions on how to become a maintainer.<br />
<br />
* This mail describes the procedure how to become maintainer, and how to modify or add modules: [http://www.cmake.org/pipermail/cmake/2007-July/015258.html Call for maintainers]<br />
<br />
* Maintainers should follow the guide lines for module files documented here: [http://www.cmake.org/cgi-bin/viewcvs.cgi/Modules/readme.txt?root=CMake&view=markup readme]<br />
<br />
In addition backwards compatibility for all existing variables in the current set<br />
of modules must be maintained strictly. <br />
<br />
If you want to become a module maintainer, please send an email with your module to the cmake mailing list.<br />
<br />
* Here is a list of "repositories" of 3rd party CMake modules, so maintainers can check for already existing modules etc.<br />
** KDE4: http://websvn.kde.org/trunk/KDE/kdelibs/cmake/modules/<br />
** PlPlot: http://plplot.svn.sourceforge.net/viewvc/plplot/trunk/cmake/modules/<br />
** http://cmake-modules.googlecode.com/svn/trunk/Modules/<br />
** OpenSceneGraph http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk/CMakeModules/<br />
** OpenSync http://svn.opensync.org/branches/3rd-party-cmake-modules/modules/<br />
** http://github.com/jedbrown/cmake-modules<br />
<br />
----<br />
<br />
<br />
* FindBoost.cmake - Andreas Schneider, mail at cynapses dot org<br />
* [http://www.cmake.org/cgi-bin/viewcvs.cgi/Modules/FindwxWidgets.cmake?root=CMake&view=markup FindwxWidgets.cmake], [http://www.cmake.org/cgi-bin/viewcvs.cgi/Modules/FindLATEX.cmake?root=CMake&view=markup FindLATEX], [http://www.cmake.org/cgi-bin/viewcvs.cgi/Modules/FindImageMagick.cmake?root=CMake&view=markup FindImageMagick] - Miguel A. Figueroa Villanueva, miguelf at ieee dot org<br />
* Ada - Alan W. Irwin, irwin at beluga dot phys dot uvic dot ca<br />
* FindSWIG, UseSWIG, FindSubversion - Tristan Carel, tristan dot carel at gmail dot com<br />
* [http://www.cmake.org/cgi-bin/viewcvs.cgi/Modules/FindBLAS.cmake?root=CMake&view=markup FindBLAS], [http://www.cmake.org/cgi-bin/viewcvs.cgi/Modules/FindLAPACK.cmake?root=CMake&view=markup FindLAPACK] - Alin M Elena, alinm dot elena at gmail dot com (http://titus.phy.qub.ac.uk/group/Alin/)<br />
* D support - Tim Burrell (tim dot burrell at gmail dot com) (http://www.dsource.org/projects/cmaked)<br />
* FindFreeType.cmake, FindGDAL.cmake, FindGIFLIB.cmake, FindLua50.cmake, FindLua51.cmake, FindOpenAL.cmake, FindOpenThreads.cmake, FindPhysFS.cmake. FindProducer.cmake, FindQuickTime.cmake. FindSDL.cmake, FindSDL_image.cmake, FindSDL_mixer.cmake. FindSDL_net.cmake, FindSDL_sound.cmake, FindSDL_ttf.cmake, Findosg.cmake, FindosgDB.cmake, FindosgFX.cmake, FindosgGA.cmake, FindosgIntrospection.cmake, FindosgManipulator.cmake, FindosgParticle.cmake, FindosgProducer.cmake, FindosgShadow.cmake, FindosgSim.cmake, FindosgTerrain.cmake, FindosgText.cmake, FindosgUtil.cmake, FindosgViewer.cmake (Eric Wing ; in the commercial domain at gmail, ewing . public)<br />
* FindMPI - Douglas Gregor (doug.gregor at gmail dot com)<br />
* FindMagick, FindCxxTest - Philip Lowman, philip at yhbt dot com<br />
* FindCoin3D - Matt Leotta, matt.leotta at gmail dot com<br />
* FindQt4 - Clinton Stimpson clinton at elemtech dot com<br />
* FindRTI - Petr Gotthard, petr dot gotthard at honeywell dot com</div>JedBrownhttps://public.kitware.com/Wiki/index.php?title=CMake:Static_libraries&diff=14061CMake:Static libraries2008-11-09T17:08:49Z<p>JedBrown: </p>
<hr />
<div>Writing a FindXXX.cmake module that works with shared libraries is relatively easy. You need only find the ''interface'' libraries and the system will take care of resolving dependencies when the executable is run. With static libraries, the linker must be provided with the entire dependency graph. Determining the dependency graph is project-specific, but common methods are wrapper compilers, Makefile systems, and pkg-config. All of these provide a link line which includes all dependencies. However, CMake does not accept link lines directly. A hack is for the CMake module to parse the link line itself. To be truly portable, the semantics of the underlying linker must be preserved. Normally this means that each library pathh is added to a stack and each library is searched in this stack and then in system directories. Every module distributed with CMake that attempts to parse link lines gets this wrong as of 2.6.3rc1 when [[CMake:Multiple versions| multiple versions]] of libraries are present. Most FindXXX modules make no attempt to resolve dependencies, hence require manual intervention when shared libraries are not available.<br />
<br />
The [http://github.com/jedbrown/cmake-modules/tree/master/ResolveCompilerPaths.cmake ResolveCompilerPaths] module provides macros RESOLVE_LIBRARIES and RESOLVE_INCLUDES which do better, but still are not perfect. Example FindXXX modules which uses these macros are [http://github.com/jedbrown/cmake-modules/tree/master/FindPETSc.cmake FindPETSc.cmake] and [http://github.com/jedbrown/cmake-modules/tree/master/FindiMesh.cmake FindiMesh.cmake].<br />
<br />
There is no way to ask FIND_LIBRARY to only find static libraries. See [http://www.cmake.org/pipermail/cmake/2008-November/025090.html this] feature request.</div>JedBrownhttps://public.kitware.com/Wiki/index.php?title=Multiple_versions&diff=14060Multiple versions2008-11-09T17:07:44Z<p>JedBrown: Multiple versions moved to CMake:Multiple versions: namespace</p>
<hr />
<div>#REDIRECT [[CMake:Multiple versions]]</div>JedBrownhttps://public.kitware.com/Wiki/index.php?title=CMake:Multiple_versions&diff=14059CMake:Multiple versions2008-11-09T17:07:44Z<p>JedBrown: Multiple versions moved to CMake:Multiple versions: namespace</p>
<hr />
<div>When multiple ABI-incompatible versions of libraries are installed, it is likely that existing FindXXX modules will not be able to find a version in a nonstandard location, or will find a combination of libraries that produces a broken executable. Some will work correctly if XXX_DIR is set the first time CMake is run, but if the wrong version is found on the first pass (perhaps because the user didn't know they had to set this variable in advanced), the only way (short of manually editing a possibly huge number of advanced cache entries) to switch versions is to delete the cache and try again.<br />
<br />
A suggestion is for all packages to make all the advanced XXX_INCLUDES, XXX_LIBRARIES, ... cache entries subordinate to an XXX_DIR cache entry (which takes precedence over an XXX_DIR environment variable. When XXX_DIR is set, it should take precedence over system search paths (i.e. must use HINTS because PATHS is searched [http://public.kitware.com/Bug/view.php?id=8035 too late]). If XXX_DIR is changed, the advanced entries should be recomputed. CMake currently makes this awkward, but the [http://github.com/jedbrown/cmake-modules/tree/master/FindPackageMultipass.cmake FindPackageMultipass] module provides some help. For example usage, see [http://github.com/jedbrown/cmake-modules/tree/master/FindPETSc.cmake FindPETSc.cmake] or [http://github.com/jedbrown/cmake-modules/tree/master/FindiMesh.cmake FindiMesh.cmake]. Since almost every package would be better with this behavior, maybe something similar could be incorporated in CMake or at least a nicer interface could be designed.<br />
<br />
Handling multiple versions correctly with wrapper compilers, Makefile includes, and pkg-config requires preserving the semantics of the linker. See [http://github.com/jedbrown/cmake-modules/tree/master/ResolveCompilerPaths.cmake ResolveCompilerPaths] and the discussion of [[CMake:Static libraries| static libraries]].</div>JedBrownhttps://public.kitware.com/Wiki/index.php?title=CMake:Multiple_versions&diff=14058CMake:Multiple versions2008-11-09T17:07:25Z<p>JedBrown: </p>
<hr />
<div>When multiple ABI-incompatible versions of libraries are installed, it is likely that existing FindXXX modules will not be able to find a version in a nonstandard location, or will find a combination of libraries that produces a broken executable. Some will work correctly if XXX_DIR is set the first time CMake is run, but if the wrong version is found on the first pass (perhaps because the user didn't know they had to set this variable in advanced), the only way (short of manually editing a possibly huge number of advanced cache entries) to switch versions is to delete the cache and try again.<br />
<br />
A suggestion is for all packages to make all the advanced XXX_INCLUDES, XXX_LIBRARIES, ... cache entries subordinate to an XXX_DIR cache entry (which takes precedence over an XXX_DIR environment variable. When XXX_DIR is set, it should take precedence over system search paths (i.e. must use HINTS because PATHS is searched [http://public.kitware.com/Bug/view.php?id=8035 too late]). If XXX_DIR is changed, the advanced entries should be recomputed. CMake currently makes this awkward, but the [http://github.com/jedbrown/cmake-modules/tree/master/FindPackageMultipass.cmake FindPackageMultipass] module provides some help. For example usage, see [http://github.com/jedbrown/cmake-modules/tree/master/FindPETSc.cmake FindPETSc.cmake] or [http://github.com/jedbrown/cmake-modules/tree/master/FindiMesh.cmake FindiMesh.cmake]. Since almost every package would be better with this behavior, maybe something similar could be incorporated in CMake or at least a nicer interface could be designed.<br />
<br />
Handling multiple versions correctly with wrapper compilers, Makefile includes, and pkg-config requires preserving the semantics of the linker. See [http://github.com/jedbrown/cmake-modules/tree/master/ResolveCompilerPaths.cmake ResolveCompilerPaths] and the discussion of [[CMake:Static libraries| static libraries]].</div>JedBrownhttps://public.kitware.com/Wiki/index.php?title=CMake:Multiple_versions&diff=14057CMake:Multiple versions2008-11-09T17:03:04Z<p>JedBrown: </p>
<hr />
<div>When multiple ABI-incompatible versions of libraries are installed, it is likely that existing FindXXX modules will not be able to find a version in a nonstandard location, or will find a combination of libraries that produces a broken executable. Some will work correctly if XXX_DIR is set the first time CMake is run, but if the wrong version is found on the first pass (perhaps because the user didn't know they had to set this variable in advanced), the only way (short of manually editing a possibly huge number of advanced cache entries) to switch versions is to delete the cache and try again.<br />
<br />
A suggestion is for all packages to make all the advanced XXX_INCLUDES, XXX_LIBRARIES, ... cache entries subordinate to an XXX_DIR cache entry (which takes precedence over an XXX_DIR environment variable. When XXX_DIR is set, it should take precedence over system search paths (i.e. must use HINTS because PATHS is searched [http://public.kitware.com/Bug/view.php?id=8035 too late]). If XXX_DIR is changed, the advanced entries should be recomputed. CMake currently makes this awkward, but the [http://github.com/jedbrown/cmake-modules/tree/master/FindPackageMultipass.cmake FindPackageMultipass] module provides some help. For example usage, see [http://github.com/jedbrown/cmake-modules/tree/master/FindPETSc.cmake FindPETSc.cmake] or [http://github.com/jedbrown/cmake-modules/tree/master/FindiMesh.cmake FindiMesh.cmake]. Since almost every package would be better with this behavior, maybe something similar could be incorporated in CMake or at least a nicer interface could be designed.<br />
<br />
Handling multiple versions correctly with wrapper compilers, Makefile includes, and pkg-config requires preserving the semantics of the linker. See [http://github.com/jedbrown/cmake-modules/tree/master/ResolveCompilerPaths.cmake ResolveCompilerPaths] and the discussion at [[CMake:Static libraries]].</div>JedBrownhttps://public.kitware.com/Wiki/index.php?title=CMake:Static_libraries&diff=14056CMake:Static libraries2008-11-09T17:02:26Z<p>JedBrown: </p>
<hr />
<div>Writing a FindXXX.cmake module that works with shared libraries is relatively easy. You need only find the ''interface'' libraries and the system will take care of resolving dependencies when the executable is run. With static libraries, the linker must be provided with the entire dependency graph. Determining the dependency graph is project-specific, but common methods are wrapper compilers, Makefile systems, and pkg-config. All of these provide a link line which includes all dependencies. However, CMake does not accept link lines directly. A hack is for the CMake module to parse the link line itself. To be truly portable, the semantics of the underlying linker must be preserved. Normally this means that each library pathh is added to a stack and each library is searched in this stack and then in system directories. Every module distributed with CMake that attempts to parse link lines gets this wrong as of 2.6.3rc1 when [[Multiple versions]] of libraries are present. Most FindXXX modules make no attempt to resolve dependencies, hence require manual intervention when shared libraries are not available.<br />
<br />
The [http://github.com/jedbrown/cmake-modules/tree/master/ResolveCompilerPaths.cmake ResolveCompilerPaths] module provides macros RESOLVE_LIBRARIES and RESOLVE_INCLUDES which do better, but still are not perfect. Example FindXXX modules which uses these macros are [http://github.com/jedbrown/cmake-modules/tree/master/FindPETSc.cmake FindPETSc.cmake] and [http://github.com/jedbrown/cmake-modules/tree/master/FindiMesh.cmake FindiMesh.cmake].<br />
<br />
There is no way to ask FIND_LIBRARY to only find static libraries. See [http://www.cmake.org/pipermail/cmake/2008-November/025090.html this] feature request.</div>JedBrownhttps://public.kitware.com/Wiki/index.php?title=CMake:Multiple_versions&diff=14055CMake:Multiple versions2008-11-09T17:00:30Z<p>JedBrown: New page: Multiple versions</p>
<hr />
<div>When multiple ABI-incompatible versions of libraries are installed, it is likely that existing FindXXX modules will not be able to find a version in a nonstandard location, or will find a combination of libraries that produces a broken executable. Some will work correctly if XXX_DIR is set the first time CMake is run, but if the wrong version is found on the first pass (perhaps because the user didn't know they had to set this variable in advanced), the only way (short of manually editing a possibly huge number of advanced cache entries) to switch versions is to delete the cache and try again.<br />
<br />
A suggestion is for all packages to make all the advanced XXX_INCLUDES, XXX_LIBRARIES, ... cache entries subordinate to an XXX_DIR cache entry (which takes precedence over an XXX_DIR environment variable. When XXX_DIR is set, it should take precedence over system search paths (i.e. must use HINTS because PATHS is searched [http://public.kitware.com/Bug/view.php?id=8035 too late]). If XXX_DIR is changed, the advanced entries should be recomputed. CMake currently makes this awkward, but the [http://github.com/jedbrown/cmake-modules/tree/master/FindPackageMultipass.cmake FindPackageMultipass] module provides some help. For example usage, see [http://github.com/jedbrown/cmake-modules/tree/master/FindPETSc.cmake FindPETSc.cmake] or [http://github.com/jedbrown/cmake-modules/tree/master/FindiMesh.cmake FindiMesh.cmake]. Since almost every package would be better with this behavior, maybe something similar could be incorporated in CMake or at least a nicer interface could be designed.<br />
<br />
Handling multiple versions correctly with wrapper compilers, Makefile includes, and pkg-config requires preserving the semantics of the linker. See [http://github.com/jedbrown/cmake-modules/tree/master/ResolveCompilerPaths.cmake ResolveCompilerPaths] and the discussion at [[Static libraries]].</div>JedBrownhttps://public.kitware.com/Wiki/index.php?title=CMake:Static_libraries&diff=14054CMake:Static libraries2008-11-09T16:46:17Z<p>JedBrown: New page: Static libraries</p>
<hr />
<div>Writing a FindXXX.cmake module that works with shared libraries is relatively easy. You need only find the ''interface'' libraries and the system will take care of resolving dependencies when the executable is run. With static libraries, the linker must be provided with the entire dependency graph. Determining the dependency graph is project-specific, but common methods are wrapper compilers, Makefile systems, and pkg-config. All of these provide a link line which includes all dependencies. However, CMake does not accept link lines directly. A hack is for the CMake module to parse the link line itself. To be truly portable, the semantics of the underlying linker must be preserved. Normally this means that each library pathh is added to a stack and each library is searched in this stack and then in system directories. Every module distributed with CMake that attempts to parse link lines gets this wrong as of 2.6.3rc1 when [[Multiple versions]] of libraries are present. Most FindXXX modules make no attempt to resolve dependencies, hence require manual intervention when shared libraries are not available.<br />
<br />
The [http://github.com/jedbrown/cmake-modules/tree/master/ResolveCompilerPaths.cmake ResolveCompilerPaths] module provides macros RESOLVE_LIBRARIES and RESOLVE_INCLUDES which do better, but still are not perfect. Example FindXXX modules which uses these macros are [http://github.com/jedbrown/cmake-modules/tree/master/FindPETSc.cmake FindPETSc.cmake] and [http://github.com/jedbrown/cmake-modules/tree/master/FindiMesh.cmake FindiMesh.cmake].<br />
<br />
There is no way to ask FIND_LIBRARY to only find static libraries. See [http://public.kitware.com/Bug/view.php?id=8035 this] bug report.</div>JedBrownhttps://public.kitware.com/Wiki/index.php?title=CMake&diff=14052CMake2008-11-09T15:59:22Z<p>JedBrown: /* More Topics */</p>
<hr />
<div>http://www.cmake.org/cmake/img/CMake-logo-download.jpg<br />
<br />
<!-- documentation manual man information help tutorial --><br />
Welcome to CMake, the cross-platform, open-source make system. CMake is used to control the software compilation process using simple platform and compiler independent configuration files. CMake generates native makefiles and workspaces that can be used in the compiler environment of your choice. CMake is quite sophisticated: it is possible to support complex environments requiring system configuration, pre-processor generation, code generation, and template instantiation.<br />
<br />
You will find here not only documentation for CMake, but also for CPack and CTest.<br />
<br />
==CMake ==<br />
<br />
=== Primary Resources - Look here first! ===<br />
* Where can I [http://www.cmake.org/HTML/Download.html download CMake]?<br />
* [http://www.cmake.org/HTML/Documentation.html CMake Documentation]<br />
* [[CMake Useful Variables|Useful CMake Variables]]<br />
* [[CMake FAQ| FAQ (Frequently asked questions)]]<br />
* [http://www.cmake.org/mailman/listinfo/cmake CMake Mailing List]<br />
* [[CMake_2.6_Notes|CMake 2.6 Notes]]<br />
<br />
=== Development Topics===<br />
* [[CMake Cross Compiling| Cross compiling]]<br />
* [[CMake RPATH handling|RPATH handling]]<br />
* [[CMake Editors Support|Editors/IDEs with CMake syntax support]]<br />
* [[CMake Generator Specific Information|Docs for Specific Project Generators]] (Eclipse, KDevelop3, CodeBlocks, Makefile)<br />
* [[CMake User Contributed Macros| Contributed macros]]<br />
* [[CMake:Module Maintainers|Module Maintainers]]<br />
* [[CMake:VariablesListsStrings| On variables, lists, strings, maps, regexps, etc.]]<br />
* [[CMake Platform Dependent Issues|Platform Dependent Information]]<br />
* [[CMake Released Versions|Documentation for previous releases]]<br />
<br />
===Tutorials===<br />
<br />
====Basic Introductions====<br />
* [http://www.cmake.org/HTML/Examples.html A Simple CMake Example]<br />
* [http://www.linuxjournal.com/article/6700 Cross-Platform Software Development Using CMake]<br />
* [http://clubjuggler.livejournal.com/138364.html CMake: The Cross Platform Build System]<br />
* [http://www.elpauer.org/stuff/learning_cmake.pdf "Learning CMake"] - Slides of a CMake workshop (somewhat updated for CMake 2.6, include CPack, CTest and CDash information)<br />
* Syntax of the CMake language<br />
** [http://www.cmake.org/HTML/syntax.html A quick introduction to CMake syntax]<br />
** [[/Language Syntax]] (wiki page)<br />
<br />
====Specific Topics====<br />
* [[CMake:How_To_Find_Libraries | How to find libraries]] <br>Describes how to use external libraries in a CMake project and how to write your own find modules for libraries that don't already have one.<br />
* [[CMake:Eclipse_UNIX_Tutorial | How to use CMake with Eclipse CDT]] <br> Describes how to use CMake with Eclipse CDT.<br />
* [[CMake HowToDoPlatformChecks| How to write platform checks with CMake]]<br>Describes how to implement platform or configure checks with CMake.<br />
<br />
* [[CMake HowToFindInstalledSoftware| How to find installed software with CMake]]<br>Describes how to search for and then use software packages with CMake.<br />
<br />
* [[CMake:HowToUseExistingOSXFrameworks | How to find and use existing frameworks on OS X]]<br> A quick example to help OS X users find frameworks automatically.<br />
<br />
* [[CMake:How To Build Qt4 Software | How to build Qt4 software with CMake]]<br />
<br />
* [[CMake:How To Build KDE4 Software | How to build KDE4 software with CMake]]<br />
<br />
* [[CMake:How To Process Lots Of Input Files | How to process lots of input files with a processor built by CMake]]<br />
<br />
* [http://qtnode.net/wiki?title=Qt_with_cmake Qt with CMake] <br>Explains how to use CMake to build software with Qt4, Qt3 and KDE3.<br />
<br />
* [http://www.wxwidgets.org/wiki/index.php/CMake How to use CMake for building software with wxWidgets ]<br />
<br />
* [http://www.linuxdevices.com/articles/AT6762290643.html Building eCos applications with CMake]<br />
<br />
* [[CMakeForFLTK| Using CMake to build an FLTK application]]<br />
<br />
* [[BuildingWinDLL| How to export symbols from a Windows DLL for the non-Windows Developer]]<br />
<br />
* [[BuildingOSXApplications| How to create a Stand Alone OS X Application bundle with Qt Support]]<br />
<br />
* [[VSConfigSpecificSettings| Configuration Specific Settings for Visual Studio Generated Project Files]]<br />
<br />
* [[BundleUtilitiesExample| How to use the 'BundleUtilities' to deploy your OS X Application]]<br />
<br />
* [[CMakeForFortranExample|How to write a simple CMakeLists.txt for Fortran code]]<br />
<br />
===Converters from other buildsystems to CMake===<br />
<br />
All converters listed here are not "complete", i.e. the generated CMake files are not 100% finished, in all cases some work is left for the developer.<br />
<br />
====automake/autotools/autoconf====<br />
* [http://websvn.kde.org/trunk/KDE/kdesdk/cmake/scripts/ am2cmake (requires Ruby) ] Converts automake/autotools/libtool based projects to CMake, specialized in converting from KDE 3 to KDE 4, should also work for others. This one has been used for converting the KDE buildsystem to CMake.<br />
<br />
* [http://emanuelgreisen.dk/stuff/kdevelop_am2cmake.php.tgz Alternative Automake2CMake (requires PHP)] Converts KDevelop projects that use automake to CMake.<br />
<br />
* [[GccXmlAutoConfHints|Converting autoconf tests]]<br />
<br />
====qmake====<br />
* [[CMake:ConvertFromQmake | qmake converter (requires Ruby)]] Converts projects that use Qt's qmake.<br />
<br />
<br />
====Visual Studio====<br />
* [http://www.eskilson.se/vcproj2cmake.rb vcproj2cmake.rb (requires Ruby)] Creates CMakeLists.txt files by extracting info from Visual Studio project files.<br />
<br />
====Basic CMakeLists.txt from-scratch-generator====<br />
* [http://websvn.kde.org/trunk/KDE/kdesdk/cmake/scripts/ gencmake (requires Ruby) ] Creates basic CMakeLists.txt files from looking at the existing files.<br />
<br />
===Success Stories===<br />
<br />
* What are some [[CMake Projects|projects using CMake]]?<br />
* [[CMake:Articles|Articles about CMake]]<br />
* [[Really Cool CMake Features]]<br />
<br />
===More Topics===<br />
<br />
* [[CMake Fortran Issues|Fortran Issues]]<br />
* [[CMake:For CMake Hackers|For CMake Hackers]]<br />
* [[CMake:Experiments With Lua|Experiments With Lua]]<br />
* [[CMake Performance Tips|Performance Tips]]<br />
* [[CMake:Install Commands| Replacing deprecated INSTALL_FILES, INSTALL_PROGRAMS and INSTALL_TARGETS commands]]<br />
* [[CMake:GNU style example | GNU style directory layout with CMake]]<br />
* [[CMake:OpenTasks| CMake TODO]]<br />
* [[CMake:CreateQtAssistantDocs| Creating Qt Assistant Docs]]<br />
* [[CMake:Static libraries| Writing FindXXX.cmake modules that work with static libraries]]<br />
* [[CMake:Multiple versions| Writing FindXXX.cmake modules that work when multiple versions of packages are installed]]<br />
<br />
==CTest==<br />
<br />
===Tutorials===<br />
* [[CMake Testing With CTest|Testing With CTest]]<br>Introduces to testing with CTest, submitting dashboards, and using CMake to add tests to the test system.<br />
<br />
* [[CMake Scripting Of CTest|CTest Scripting]]<br>Describes the scripting with CTest which can significantly simplify and automate testing and submitting dashboards.<br />
<br />
* [[CMake Generating Testing Files|Generating Input Files For CTest]]<br>Describe more in details the concepts behind testing with CTest and also explans how to use CTest without using CMake.<br />
<br />
===More Information===<br />
* [[CTest:Submission Issues|Configuring CTest Submission Methods]]<br />
* [[CTest:Nightly, Experimental, Continuous|CTest Nightly, Experimental, Continuous, ...]]<br />
* [[CTest:Coverage]]<br />
* [[Media:CTest Running Modes.pdf]]<br />
* [[CTest:FAQ|CTest Frequently asked questions]]<br />
<br />
===More Topics===<br />
* [[CTest:OpenTasks| CTest TODO]]<br />
<br />
==CPack==<br />
===Tutorials===<br />
* [[CMake:Packaging With CPack|Packaging with CPack]]<br>Introduction to CPack, installing and packaging of software.<br />
* [[CMake:CPackConfiguration|CPack Variables]]<br><br />
* [[CMake:CPackPackageGenerators|Supported package formats]]<br><br />
* [[CMake:CPackWin32NewbiesChecklist|CPack Win32 Newbie Checklist]] <br><br />
<br />
===More Information===<br />
* [[CPack:Generator Information|CPack Generator Information]]<br />
<br />
==CDash==<br />
* [[CDash|CDash Wiki]].<br />
* [[CDash:FAQ|CDash FAQ]].<br />
<br />
{{CMake/Template/Footer}}</div>JedBrownhttps://public.kitware.com/Wiki/index.php?title=CMake&diff=14051CMake2008-11-09T15:58:57Z<p>JedBrown: /* More Topics */ Static libraries and Multiple versions</p>
<hr />
<div>http://www.cmake.org/cmake/img/CMake-logo-download.jpg<br />
<br />
<!-- documentation manual man information help tutorial --><br />
Welcome to CMake, the cross-platform, open-source make system. CMake is used to control the software compilation process using simple platform and compiler independent configuration files. CMake generates native makefiles and workspaces that can be used in the compiler environment of your choice. CMake is quite sophisticated: it is possible to support complex environments requiring system configuration, pre-processor generation, code generation, and template instantiation.<br />
<br />
You will find here not only documentation for CMake, but also for CPack and CTest.<br />
<br />
==CMake ==<br />
<br />
=== Primary Resources - Look here first! ===<br />
* Where can I [http://www.cmake.org/HTML/Download.html download CMake]?<br />
* [http://www.cmake.org/HTML/Documentation.html CMake Documentation]<br />
* [[CMake Useful Variables|Useful CMake Variables]]<br />
* [[CMake FAQ| FAQ (Frequently asked questions)]]<br />
* [http://www.cmake.org/mailman/listinfo/cmake CMake Mailing List]<br />
* [[CMake_2.6_Notes|CMake 2.6 Notes]]<br />
<br />
=== Development Topics===<br />
* [[CMake Cross Compiling| Cross compiling]]<br />
* [[CMake RPATH handling|RPATH handling]]<br />
* [[CMake Editors Support|Editors/IDEs with CMake syntax support]]<br />
* [[CMake Generator Specific Information|Docs for Specific Project Generators]] (Eclipse, KDevelop3, CodeBlocks, Makefile)<br />
* [[CMake User Contributed Macros| Contributed macros]]<br />
* [[CMake:Module Maintainers|Module Maintainers]]<br />
* [[CMake:VariablesListsStrings| On variables, lists, strings, maps, regexps, etc.]]<br />
* [[CMake Platform Dependent Issues|Platform Dependent Information]]<br />
* [[CMake Released Versions|Documentation for previous releases]]<br />
<br />
===Tutorials===<br />
<br />
====Basic Introductions====<br />
* [http://www.cmake.org/HTML/Examples.html A Simple CMake Example]<br />
* [http://www.linuxjournal.com/article/6700 Cross-Platform Software Development Using CMake]<br />
* [http://clubjuggler.livejournal.com/138364.html CMake: The Cross Platform Build System]<br />
* [http://www.elpauer.org/stuff/learning_cmake.pdf "Learning CMake"] - Slides of a CMake workshop (somewhat updated for CMake 2.6, include CPack, CTest and CDash information)<br />
* Syntax of the CMake language<br />
** [http://www.cmake.org/HTML/syntax.html A quick introduction to CMake syntax]<br />
** [[/Language Syntax]] (wiki page)<br />
<br />
====Specific Topics====<br />
* [[CMake:How_To_Find_Libraries | How to find libraries]] <br>Describes how to use external libraries in a CMake project and how to write your own find modules for libraries that don't already have one.<br />
* [[CMake:Eclipse_UNIX_Tutorial | How to use CMake with Eclipse CDT]] <br> Describes how to use CMake with Eclipse CDT.<br />
* [[CMake HowToDoPlatformChecks| How to write platform checks with CMake]]<br>Describes how to implement platform or configure checks with CMake.<br />
<br />
* [[CMake HowToFindInstalledSoftware| How to find installed software with CMake]]<br>Describes how to search for and then use software packages with CMake.<br />
<br />
* [[CMake:HowToUseExistingOSXFrameworks | How to find and use existing frameworks on OS X]]<br> A quick example to help OS X users find frameworks automatically.<br />
<br />
* [[CMake:How To Build Qt4 Software | How to build Qt4 software with CMake]]<br />
<br />
* [[CMake:How To Build KDE4 Software | How to build KDE4 software with CMake]]<br />
<br />
* [[CMake:How To Process Lots Of Input Files | How to process lots of input files with a processor built by CMake]]<br />
<br />
* [http://qtnode.net/wiki?title=Qt_with_cmake Qt with CMake] <br>Explains how to use CMake to build software with Qt4, Qt3 and KDE3.<br />
<br />
* [http://www.wxwidgets.org/wiki/index.php/CMake How to use CMake for building software with wxWidgets ]<br />
<br />
* [http://www.linuxdevices.com/articles/AT6762290643.html Building eCos applications with CMake]<br />
<br />
* [[CMakeForFLTK| Using CMake to build an FLTK application]]<br />
<br />
* [[BuildingWinDLL| How to export symbols from a Windows DLL for the non-Windows Developer]]<br />
<br />
* [[BuildingOSXApplications| How to create a Stand Alone OS X Application bundle with Qt Support]]<br />
<br />
* [[VSConfigSpecificSettings| Configuration Specific Settings for Visual Studio Generated Project Files]]<br />
<br />
* [[BundleUtilitiesExample| How to use the 'BundleUtilities' to deploy your OS X Application]]<br />
<br />
* [[CMakeForFortranExample|How to write a simple CMakeLists.txt for Fortran code]]<br />
<br />
===Converters from other buildsystems to CMake===<br />
<br />
All converters listed here are not "complete", i.e. the generated CMake files are not 100% finished, in all cases some work is left for the developer.<br />
<br />
====automake/autotools/autoconf====<br />
* [http://websvn.kde.org/trunk/KDE/kdesdk/cmake/scripts/ am2cmake (requires Ruby) ] Converts automake/autotools/libtool based projects to CMake, specialized in converting from KDE 3 to KDE 4, should also work for others. This one has been used for converting the KDE buildsystem to CMake.<br />
<br />
* [http://emanuelgreisen.dk/stuff/kdevelop_am2cmake.php.tgz Alternative Automake2CMake (requires PHP)] Converts KDevelop projects that use automake to CMake.<br />
<br />
* [[GccXmlAutoConfHints|Converting autoconf tests]]<br />
<br />
====qmake====<br />
* [[CMake:ConvertFromQmake | qmake converter (requires Ruby)]] Converts projects that use Qt's qmake.<br />
<br />
<br />
====Visual Studio====<br />
* [http://www.eskilson.se/vcproj2cmake.rb vcproj2cmake.rb (requires Ruby)] Creates CMakeLists.txt files by extracting info from Visual Studio project files.<br />
<br />
====Basic CMakeLists.txt from-scratch-generator====<br />
* [http://websvn.kde.org/trunk/KDE/kdesdk/cmake/scripts/ gencmake (requires Ruby) ] Creates basic CMakeLists.txt files from looking at the existing files.<br />
<br />
===Success Stories===<br />
<br />
* What are some [[CMake Projects|projects using CMake]]?<br />
* [[CMake:Articles|Articles about CMake]]<br />
* [[Really Cool CMake Features]]<br />
<br />
===More Topics===<br />
<br />
* [[CMake Fortran Issues|Fortran Issues]]<br />
* [[CMake:For CMake Hackers|For CMake Hackers]]<br />
* [[CMake:Experiments With Lua|Experiments With Lua]]<br />
* [[CMake Performance Tips|Performance Tips]]<br />
* [[CMake:Install Commands| Replacing deprecated INSTALL_FILES, INSTALL_PROGRAMS and INSTALL_TARGETS commands]]<br />
* [[CMake:GNU style example | GNU style directory layout with CMake]]<br />
* [[CMake:OpenTasks| CMake TODO]]<br />
* [[CMake:CreateQtAssistantDocs| Creating Qt Assistant Docs]]<br />
* [[CMake:Static libraries| Writing FindXXX.cmake modules that work with shared libraries]]<br />
* [[CMake:Multiple versions| Writing FindXXX.cmake modules that work when multiple versions of packages are installed]]<br />
<br />
==CTest==<br />
<br />
===Tutorials===<br />
* [[CMake Testing With CTest|Testing With CTest]]<br>Introduces to testing with CTest, submitting dashboards, and using CMake to add tests to the test system.<br />
<br />
* [[CMake Scripting Of CTest|CTest Scripting]]<br>Describes the scripting with CTest which can significantly simplify and automate testing and submitting dashboards.<br />
<br />
* [[CMake Generating Testing Files|Generating Input Files For CTest]]<br>Describe more in details the concepts behind testing with CTest and also explans how to use CTest without using CMake.<br />
<br />
===More Information===<br />
* [[CTest:Submission Issues|Configuring CTest Submission Methods]]<br />
* [[CTest:Nightly, Experimental, Continuous|CTest Nightly, Experimental, Continuous, ...]]<br />
* [[CTest:Coverage]]<br />
* [[Media:CTest Running Modes.pdf]]<br />
* [[CTest:FAQ|CTest Frequently asked questions]]<br />
<br />
===More Topics===<br />
* [[CTest:OpenTasks| CTest TODO]]<br />
<br />
==CPack==<br />
===Tutorials===<br />
* [[CMake:Packaging With CPack|Packaging with CPack]]<br>Introduction to CPack, installing and packaging of software.<br />
* [[CMake:CPackConfiguration|CPack Variables]]<br><br />
* [[CMake:CPackPackageGenerators|Supported package formats]]<br><br />
* [[CMake:CPackWin32NewbiesChecklist|CPack Win32 Newbie Checklist]] <br><br />
<br />
===More Information===<br />
* [[CPack:Generator Information|CPack Generator Information]]<br />
<br />
==CDash==<br />
* [[CDash|CDash Wiki]].<br />
* [[CDash:FAQ|CDash FAQ]].<br />
<br />
{{CMake/Template/Footer}}</div>JedBrown