Skip to content

Commit 205b840

Browse files
author
Roberto Di Remigio
committed
1 parent 9ce8d46 commit 205b840

File tree

4 files changed

+23
-9
lines changed

4 files changed

+23
-9
lines changed

CMakeLists.txt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ set(CMAKE_MODULE_PATH
2424
${CMAKE_SOURCE_DIR}/cmake
2525
${CMAKE_SOURCE_DIR}/cmake/compilers
2626
${CMAKE_SOURCE_DIR}/cmake/math
27-
${CMAKE_SOURCE_DIR}/cmake/testing
28-
)
27+
${CMAKE_SOURCE_DIR}/cmake/testing)
2928

3029
set(LIBS)
30+
set(header_dir_list)
3131
set(libs_to_merge)
3232

3333
include(ConfigVersion)
@@ -45,6 +45,7 @@ FortranCInterface_HEADER(include/FCMangle.hpp)
4545
include(MergeStaticLibs)
4646

4747
find_package(PythonInterp REQUIRED)
48+
find_package(ZLIB REQUIRED)
4849

4950
set(Boost_USE_STATIC_LIBS ON)
5051
if(ENABLE_TESTS)
@@ -163,6 +164,7 @@ file(COPY ${PROJECT_BINARY_DIR}/update_gh-pages.py
163164
include_directories(${EIGEN3_INCLUDE_DIR}
164165
${Boost_INCLUDE_DIRS}
165166
${Boost_QUADRATURE}
167+
${ZLIB_INCLUDE_DIRS}
166168
${PROJECT_SOURCE_DIR}
167169
${PROJECT_SOURCE_DIR}/external
168170
${PROJECT_BINARY_DIR}/include
@@ -195,8 +197,10 @@ install(FILES
195197
if(ENABLE_TESTS)
196198
include(ConfigFramework)
197199
include(TestingMacros)
200+
201+
find_package(Threads REQUIRED)
198202

199-
set(LIBS pthread z ${LIBS})
203+
list(APPEND LIBS ${CMAKE_THREAD_LIBS_INIT} ${ZLIB_LIBRARIES})
200204

201205
setup_boosttest()
202206

@@ -211,7 +215,5 @@ endif()
211215
# Merge static libs from subfolders into one static lib: libpcm.a
212216
# This is the very last thing we do, i.e. DO NOT add anything depending on this target!!!
213217
merge_static_libs(pcm
214-
"${libs_to_merge}"
215-
)
218+
"${libs_to_merge}")
216219
install(TARGETS pcm ARCHIVE DESTINATION lib)
217-

doc/Building.dox

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ that you have a sane build, you will have to run the unit test suite.
4242
+ Eigen libraries version 3.0.0 and higher;
4343
\note Version 3.2.0 of Eigen libraries is shipped with the module and resides in the `external` subdirectory.
4444
Unless you want to use another version of Eigen, you should not worry about satisfying this dependency.
45-
+ `libzip` (unit test suite only);
45+
+ [zlib](http://www.zlib.net/) (unit test suite only);
4646
+ Pthread (unit test suite only);
4747
+ Doxygen version 1.7.6 and higher (documentation only)
4848

doc/CMakeUsage.dox

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,4 +120,17 @@ CMakeLists.txt in the project tree. This is achieved by using the touch_cmakelis
120120
script found in build/bin (build is the name chosen for the build directory)
121121
If you add new files *before* configuring the project there is no need to invoke touch_cmakelists
122122
prior to building.
123+
124+
### Searching for libraries
125+
In general, the use of the [find_package](http://www.cmake.org/cmake/help/v3.0/command/find_package.html) macro is to be preferred,
126+
as it is standardized and ensured to work on any platform.
127+
Use of `find_package` requires that the package/library you want to use has already a module inside the CMake distribution.
128+
If that's not the case, you should *never* use the following construct for third-party libraries:
129+
130+
target_link_libraries(myexe -lsomesystemlib)
131+
132+
If the library does not exist, the end result is a cryptic linker error. See also [this Jussi Pakkanen's blog entry](http://voices.canonical.com/jussi.pakkanen/2013/03/26/a-list-of-common-cmake-antipatterns/)
133+
You will first need to find the library, using the macro [find_library](http://www.cmake.org/cmake/help/v3.0/command/find_library.html), and then use
134+
the `target_link_libraries` command.
135+
123136
*/

src/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ set(header_dir_list
1010
${CMAKE_CURRENT_SOURCE_DIR}/solver
1111
${CMAKE_CURRENT_SOURCE_DIR}/utils
1212
${CMAKE_CURRENT_SOURCE_DIR}/wavcav
13-
${CMAKE_CURRENT_SOURCE_DIR}/wem
14-
)
13+
${CMAKE_CURRENT_SOURCE_DIR}/wem)
1514
include_directories(${header_dir_list})
1615

1716
# Initialize Includer.hpp header

0 commit comments

Comments
 (0)