cmake-cookbook icon indicating copy to clipboard operation
cmake-cookbook copied to clipboard

chapter-01/recipe-05/cxx-example/CMakeLists.txt - wrong logic

Open hanxiatu-fc opened this issue 6 years ago • 1 comments

Expected Behavior

when USE_LIBRARY is true, we can change some varible to make shared or static lib

Current Behavior

when USE_LIBRARY is true, we can only make shared lib

Possible Solution

  1. add option

option(SHARED_LIB "Compile shared lib" ON)

  1. use USE_LIBRARY and SHARED_LIB togather to decide make shared or staic lib

cmake_dependent_option( MAKE_STATIC_LIBRARY "Compile sources into a static library" ON "USE_LIBRARY;NOT SHARED_LIB" OFF )

cmake_dependent_option( MAKE_SHARED_LIBRARY "Compile sources into a shared library" ON "USE_LIBRARY;SHARED_LIB" OFF )

Steps to Reproduce (for bugs)

any

Context

any

Your Environment

any

hanxiatu-fc avatar Aug 06 '19 02:08 hanxiatu-fc

Hi and thanks for your interest in this project. This bug slipped though! Thanks for reporting it and proposing a solution.

robertodr avatar Aug 07 '19 16:08 robertodr